aspx registration form help
Hey guys, so im really knew to aspx. I'm trying to create a registration form that connects to my access database and once a user registers it sends their information to the database.
But when i run my code it goes straight to catch as exception.
Here is my code,the code i have colored in red below may be causing the problem as i do not know exactly how to code it.
Suggestions would be appritiated.
Dim conn As New OleDbConnection("provider=microsoft.Jet.OLEDB.4.0;" & _
"Data source=" & AppDomain.CurrentDomain.BaseDirectory & "App_Data\webproject1.mdb")
Dim sqlcomand As New OleDbCommand
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
sqlcomand.Connection = conn
sqlcomand.CommandText = "insert into Registration " & _
"(FirstName,LastName,Age,Gender,Address,PostCode,Email,Username,Password) Values " & "('" & _
txtfirstname.Text & "'," & _
txtlastname.Text & "," & _
txtage.Text & ",'" & _
txtgender.Text & "'," & _
txtadress.Text & "," & _
txtemail.Text & ",'" & _
txtusername.Text & ",'" & _
txtpassword.Text & "')"
MsgBox("thanks for registering please login")
Catch ex As Exception
MsgBox("Error you cannot register")