Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MySQL Abfragen in C#

Empfohlene Antworten

Hallo Leute,

ich brauche mal wieder hilfe von euch:).

Folgendes zu meinem Problem.

Ich schreibe ein Program (C# Visual Studio) wo ich auf der oberfläche 5 radiobuttons habe. Je nach auswahl des radiobuttons soll das Programm mir die Werte 1 bis 5 in die mySQL Datenbank reinschreiben.

Das habe ich schon:post-80408-14430448958802_thumb.jpg

private void Bewertung_speichern()

        {

            string GrafBew;


            if (radioButton_1.Checked)

            {

                GrafBew = "1";

            }

            else if (radioButton_2.Checked)

	{

                GrafBew = "2";

	 }

            else if (radioButton_3.Checked)

	{

                GrafBew = "3";

	 }

            else if (radioButton_4.Checked)

	{

                GrafBew = "4";

	 }

            else if (radioButton_5.Checked)

	 {

                GrafBew = "5";

	 }


            MySqlConnection myConnection = new MySqlConnection(VerbString);


            string Bewertung_Abfrage = "INSERT INTO `immodb`.`tbl_bewertung` (`ID_Bew`, `ID_Kontakt`, `Graf_Bewert`, `eigenerText`)" +

                                      "VALUES ('', '', '" + GrafBew + "', '" + richTextBox_eAngaben.Text + "');";


            MySqlCommand myCommand = new MySqlCommand(Bewertung_Abfrage);

            myCommand.Connection = myConnection;

            myConnection.Open();

            myCommand.ExecuteNonQuery();


            myCommand.Connection.Close();

        }

So und in der abfrage möchte Visual Studio halt keine Variablen drin haben. Ich muss aber diesen Wert 1 bis 5 unbedingt in die Datenbank schreiben.

Danke

Ist schon gut hab meinen Fehler gefunden. Der hat nur gemeckert weil ich oben die Variable GrafBew ohne Wert reingeschrieben habe.

Und jetzt wo ich

strin GrafBew = "";

reingeschrieben habe da hat er es gefressen.

Aber trotzdem danke.:D

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.