我的sql语句有问题吗?因为只有Client_Name正在更新,其余的保持不变。
我已经检查过所有文本框和组合框是否都不为空且与原始数据不同
sql = "UPDATE Client_Info SET Client_Name= @a, Gender= @b, Age= @c, Birthdate= @d, Address= @e, Email_Address= @f, Contact_Number= @h WHERE Client_Name='" & TextBox8.Text & "'"
sqlCom.Parameters.Add("@a", OleDb.OleDbType.VarChar).Value = TextBox18.Text
sqlCom.Parameters.Add("@b", OleDb.OleDbType.VarChar).Value = ComboBox8.Text
sqlCom.Parameters.Add("@c", OleDb.OleDbType.BigInt).Value = TextBox17.Text
sqlCom.Parameters.Add("@d", OleDb.OleDbType.Date).Value = ComboBox7.Text & " " & ComboBox6.Text & ", " & ComboBox5.Text
sqlCom.Parameters.Add("@e", OleDb.OleDbType.VarChar).Value = TextBox16.Text
sqlCom.Parameters.Add("@f", OleDb.OleDbType.VarChar).Value = TextBox15.Text
sqlCom.Parameters.Add("@h", OleDb.OleDbType.VarChar).Value = TextBox14.Text
sqlCom.ExecuteNonQuery()
答案 0 :(得分:0)
试试这个
sqlCom.Parameters.Add("@c", OleDb.OleDbType.BigInt).Value = Convert.Int64(TextBox17.Text)
sqlCom.Parameters.Add("@d", OleDb.OleDbType.Date).Value = Convert.DateTime(ComboBox7.Text & "/" & ComboBox6.Text & "/" & ComboBox5.Text)