bilro
Member
- Joined
- Jun 9, 2004
- Messages
- 9
- Programming Experience
- 3-5
i have a table in MS Access 'users'
that table have these fields:
id (auto-increment)
login (text)
password (text)
type (number)
when i try to insert a new row into the table :
Dim sql As String
sql = "INSERT INTO users (login,password,type) VALUES ('" + Me.txt_name.Text + "','" + Me.txt_password.Text + "'," + Me.cmb_typo.SelectedValue + ")"
Try
Dim connection As OleDbConnection = New OleDbConnection(Me.str_con)
Dim cmd As New OleDbCommand(sql, connection)
Dim num As Integer
cmd.CommandType = CommandType.Text
connection.Open()
num = cmd.ExecuteNonQuery()
msgbox ("success")
connection.Close()
Catch ex As Exception
Me.msg.msg_info(ex.Message)
End Try
it gives me an sintax error in the INSERT INTO instruction
if i try:
sql = "INSERT INTO users (login,password,typo) VALUES ('1','1',1)"
it gives me the same error.
can anyone help me?
that table have these fields:
id (auto-increment)
login (text)
password (text)
type (number)
when i try to insert a new row into the table :
Dim sql As String
sql = "INSERT INTO users (login,password,type) VALUES ('" + Me.txt_name.Text + "','" + Me.txt_password.Text + "'," + Me.cmb_typo.SelectedValue + ")"
Try
Dim connection As OleDbConnection = New OleDbConnection(Me.str_con)
Dim cmd As New OleDbCommand(sql, connection)
Dim num As Integer
cmd.CommandType = CommandType.Text
connection.Open()
num = cmd.ExecuteNonQuery()
msgbox ("success")
connection.Close()
Catch ex As Exception
Me.msg.msg_info(ex.Message)
End Try
it gives me an sintax error in the INSERT INTO instruction
if i try:
sql = "INSERT INTO users (login,password,typo) VALUES ('1','1',1)"
it gives me the same error.
can anyone help me?