我一遍又一遍地遇到错误,有人可以告诉我我的 INSERT 语句有什么问题吗?
这是我的代码:
Dim SQLcon As New OleDbConnection
Dim SQLdr As OleDbDataReader
Try
SQLcon.ConnectionString = "Provider=Microsoft.ACE.OleDb.12.0;" & _
"Data Source= C:\Users\cleanfuel\Desktop\ProgramniOrig\DBhospital.accdb"
Dim SQLcmd As New OleDbCommand("INSERT INTO tblLogin (Username,Password,SecretQuestion,SecretAnswer)" & _
"VALUES(@Username,@Password,@SecretQuestion,@SecretAnswer)", SQLcon)
SQLcmd.Parameters.AddWithValue("@Username", txtUser.Text)
SQLcmd.Parameters.AddWithValue("@Password", txtPass.Text)
SQLcmd.Parameters.AddWithValue("@SecretQuestion", txtSecretQ.Text)
SQLcmd.Parameters.AddWithValue("@SecretAnswer", txtSecretA.Text)
SQLcon.Open()
MsgBox("Patient Added!", MsgBoxStyle.Information)
SQLdr = SQLcmd.ExecuteReader()
Catch ex As Exception
MessageBox.Show("Error Occured, Can't Register!" & ex.Message)
Finally
SQLcon.Close()
End Try
Return ""