0
 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
4
  • maybe users is a reserved keyword? Commented Nov 25, 2014 at 0:00
  • 2
    Also: don't store passwords in plaintext. And don't treat State() like a boolean, It's an Enum. Commented Nov 25, 2014 at 0:01
  • 2
    You do not mention the whole error message, which should give a clue, but password is a reserved keyword. If this is MSSQL, use insert into [users] ([username], [password]) values('bb','ss') Commented Nov 25, 2014 at 0:10
  • sql.learncodethehardway.org Commented Nov 25, 2014 at 0:20

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.