INSERT INTO...(password) syntax error

Joined
Jun 6, 2005
Messages
2
Reaction score
0
Hi! I am currently creating a Registration form which contained: UserID, Password, FirstName and LastName.

These details would be inserted into Ms Access when I click submit button. But I encounter with the problem to insert 'Password'. It works fine if I did not insert 'Password' but if I did, it will shows that I have "syntax error: INSERT INTO..."

Did I miss something to write? Please kindly have a look on the code below, Thank you!

<%@ Import Namespace="System.Data" %>

<%@ Imports Namespace="System.Data.OleDb" %>

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

Dim InsertCmd As New OleDbCommand

Dim SQLInsert As String

Dim DBConn As OleDbConnection

Dim Connstr As String

Connstr = "Provider=Microsoft.jet.oledb.4.0;" & _

"DATA SOURCE=C:\Inetpub\wwwroot\samples\Project\bin\Project-Library.mdb"

SQLInsert = "INSERT INTO User_Profile (UserID, Password, FirstName, LastName) VALUES ('" & txtUserID.Text & "', '" & txtRegPwd.Text & "', '" & txtFirstName.Text & "', '" & txtLastName.Text & "')"

'Create connection

DBConn = New OleDbConnection(Connstr)

InsertCmd.Connection = DBConn

InsertCmd.CommandText = SQLInsert

Try

DBConn.Open()

InsertCmd.ExecuteNonQuery()

Catch ex As Exception

Response.Write(ex.ToString())

Finally

DBConn.Close()

End Try

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top