Dim sqlstr As String = ("insert into users (username, password) values('bb','ss')")
comand = New OleDb.OleDbCommand(sqlstr, con)
If con.State() Then con.Close()
con.Open()
comand.Connection = con
comand.ExecuteNonQuery()
End If
1 Answer
User is a keyword. Depending on the db Users might be, so try:
Dim sqlstr As String = ("insert into [dbo].[users] (username, password) values('bb','ss')")
comand = New OleDb.OleDbCommand(sqlstr, con)
If con.State() Then con.Close()
con.Open()
comand.Connection = con
comand.ExecuteNonQuery()
End If
Also do not store the UN/PW as plain text.
passwordis a reserved keyword. If this is MSSQL, useinsert into [users] ([username], [password]) values('bb','ss')