Public Sub register_user()
Dim con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\User\Documents\login.mdb")
con.Open()
Dim reg As New DataTable("loginadmin")
Dim aaa As New OleDb.OleDbDataAdapter("Select * from loginadmin ", con)
Dim rs As New OleDb.OleDbCommand("Insert into loginadmin(username,password) values ('" & TextBox1.Text & "', '" & TextBox2.Text & "')", con)
rs.ExecuteNonQuery()
MessageBox.Show("user successfully registerd")
con.Close()
End Sub
'调试器发现此错误“语法错误插入语句” 'da
答案 0 :(得分:0)
试试这个: - Dim rs As New OleDb.OleDbCommand ("Insert into loginadmin([username],[password]) values ('" & TextBox1.Text & "', '" & TextBox2.Text & "')", con)