''附近的语法不正确”,需要研究帮助[关闭]

问题描述 投票:-5回答:2
SqlCommand UpdateCmd = new SqlCommand("Update StudentTbl SET Firstname= @Firstname, Lastname= @Lastname, Birthday= @Birthday, Strand= @Strand, Section= @Section WHERE SID = @ID)", ConClass.con);


UpdateCmd.Parameters.AddWithValue("@ID", textBox1.Text);

UpdateCmd.Parameters.AddWithValue("@Firstname", textBox2.Text);
            UpdateCmd.Parameters.AddWithValue("@Lastname", textBox3.Text);

UpdateCmd.Parameters.AddWithValue("@Birthday", textBox4.Text);

UpdateCmd.Parameters.AddWithValue("@Strand", comboBox1.Text);
            UpdateCmd.Parameters.AddWithValue("@Section", comboBox2.Text);



            ConClass.con.Open();
            UpdateCmd.ExecuteNonQuery();
            ConClass.con.Close();
            MessageBox.Show("Information was updated successfully!");
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            comboBox1.Text = "Select Strand";
            comboBox2.Text = "Select Section";


            Ref_Grid();
    --

==========

c# sqlcommand
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.