我想在访问中插入变量,但我收到此错误消息: OleDBExeception 未处理;没有为一个或多个必需参数指定值。谁能告诉我错误在哪里?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strSurname, strName As String
strSurname = Me.TextBox1.Text
strName = Me.TextBox2.Text
Dim myConnection As OleDbConnection
Dim ConString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source= Dbtry.accdb ; Persist Security Info=True"
myConnection = New OleDbConnection(ConString)
myConnection.Open()
Dim sqlQry As String
sqlQry = "INSERT INTO BookingFly (ID,Client_Name, Client_Surname) VALUES(1,strSurname, strName)"
Dim cmd As New OleDbCommand(sqlQry, myConnection)
cmd.ExecuteNonQuery()
End Sub