Page 1 of 1

In die erste Nullreihe einfügen

Posted: 14 Apr 2025, 17:27
by Anonymous
Ich versuche, den Wert bei der ersten Null-Spalte hinzuzufügen.

Code: Select all

SqlCommand cmd = my_con.CreateCommand();
cmd.CommandText = "insert into Contents(General_Exam) values(@CC)";
cmd.Parameters.AddWithValue("@CC", txtAddOption.Text);
cmd.ExecuteNonQuery();
comboBoxAddOption.Items.Add(txtAddOption.Text);
SqlCommand cmd1 = new SqlCommand("update TOP(1) Contents SET General_Exam=@CC where General_Exam IS NULL", my_con);
cmd1.Parameters.AddWithValue("@CC", txtAddOption.Text);
cmd1.ExecuteNonQuery();
Aber wenn ich den Wert einfügte, kann er nicht in die erste Null -Zeile einfügen, anstatt dass sie in die letzte Null -Reihe eingefügt wird.>