Dim con As New OleDb.OleDbConnection
Dim str As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=..\VisitorPass.accdb"
con = New OleDbConnection(str)
Dim sql As String = "insert into Visitor(Name,Password)values ('" & txtName.Text & "','" & txtPassword.Text & "')"
Dim cmd As OleDbCommand
con.Open()
cmd = New OleDbCommand(sql, con)
cmd.ExecuteNonQuery()
MsgBox("Account is Registered")
答案 0 :(得分:0)
请尝试将字段密码括在括号中。
insert into Visitor(Name,[Password])values ..
使用MS Access时,这应该可以解决问题。