我现在不知道为什么在if语句中跳过这个方法有人可以帮我解决这个问题吗?
这是更新sql查询
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Or TextBox6.Text = "" Or TextBox7.Text = "" Or TextBox9.Text = "" Then
MsgBox("Please complete all the fields")
Else
Dim result As Integer = MessageBox.Show("Are you sure you want to Edit the information?", "Update", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
If result = DialogResult.OK Then
Edituser()
MsgBox(" Player information Updated!")
Me.Close()
Player.Show()
End If
End If
End Sub
这是if语句
{{1}}
提前致谢。
答案 0 :(得分:0)
sub叫做edituser,你在调用editplayer吗?
确定。你正在空仓块中挤压错误。您很可能在将日期参数作为字符串传递时遇到sql错误。
您需要删除try catch以查看错误消息,或将其输出到console / msgbox。
@Rahul所说的也是正确的。可能是两者的结合。
答案 1 :(得分:0)
您的UPDATE
语句在语法上是错误的,因为它缺少,
并且正确引用了列名,如下所示
sql = "UPDATE player SET `First Name`=@1, `Last Name`=@2, Gender=@3, `Date of Birth`=@4,