Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CON = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Transport.accdb")
COM = New OleDbCommand(" Update details DName=@DName,Address=@Address,DOB=@DOB,MoNo=@MoNo,LiNo=@LiNo,LiExNo=@LiExNo,Experiance=@Experiance,Note=@Note where DNo=@DNo", CON)
CON.Open()
COM.Parameters.AddWithValue("@DNo", TextBox9.Text)
COM.Parameters.AddWithValue("@DName", TextBox8.Text)
COM.Parameters.AddWithValue("@Address", TextBox1.Text)
COM.Parameters.AddWithValue("@DOB", TextBox2.Text)
COM.Parameters.AddWithValue("@MoNo", TextBox3.Text)
COM.Parameters.AddWithValue("@LiNo", TextBox4.Text)
COM.Parameters.AddWithValue("@LiExNo", TextBox5.Text)
COM.Parameters.AddWithValue("@Experiance", TextBox6.Text)
COM.Parameters.AddWithValue("@Note", TextBox7.Text)
COM.ExecuteNonQuery()
MsgBox("record Updated")
CON.Close()
答案 0 :(得分:1)
您错过了SET关键字
Update details SET DName=@DName
答案 1 :(得分:1)
您未在更新声明中编写set
个关键字。
COM = New OleDbCommand(" Update details set DName=@DName,Address=@Address,DOB=@DOB,MoNo=@MoNo,LiNo=@LiNo,LiExNo=@LiExNo,Experiance=@Experiance,Note=@Note where DNo=@DNo", CON)