Saiph0902
Member
- Joined
- Aug 8, 2011
- Messages
- 7
- Programming Experience
- Beginner
This is the code I'm using to be able to register new users onto our Sales and Inventory System, and I get an error:
and it's pointing on the line Dim dr As OleDbDataReader = cmd.ExecuteReader
![syntax%20error.jpg](http://bb.xieke.com/files/syntax%20error.jpg)
and it's pointing on the line Dim dr As OleDbDataReader = cmd.ExecuteReader
VB.NET:
Imports System.Data.OleDb
Public Class Register
Dim ds As New DataSet
Dim da As New OleDbDataAdapter
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim cn As New OleDbConnection
Dim cmd As OleDbCommand
Dim sql As String
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ds As New DataSet
Dim da As New OleDbDataAdapter
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim cn As New OleDbConnection
Dim cmd As OleDbCommand
Dim sql = "INSERT INTO Employees(GivenName, LastName, Gender, JobPosition, Month, Day, Year" & _
"Address, EmailAddress, Username, Passcode, SecretQ1, SecretQ2, SecretA1," & _
"SecretA2) VALUES('" & txtGivenName.Text & "','" & txtLastName.Text & "','" & _
"'" & cmbGender.Text & "','" & "Employee" & "','" & cmbMonth.Text & "','" & _
"'" & cmbDay.Text & "','" & cmbYear.Text & "','" & "'" & txtUsername.Text & "','" & _
"'" & txtPassword.Text & "','" & cmbSecretQ1.Text & "','" & _
"'" & cmbSecretQ2.Text & "','" & txtSecretA1.Text & "','" & txtSecretA2.Text & "')"
If txtConfirmPW.Text <> txtPassword.Text Then
MessageBox.Show("The password does not match!")
End If
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0; data source=C:\Documents and Settings\James\My Documents\MSNPharmacy 07-30-2011\MSNPharmacy\MSNPharmacy\msn_pharmacy.mdb"
cn.Open()
da = New OleDb.OleDbDataAdapter(Sql, cn)
cmd = New OleDbCommand(Sql, cn)
Dim dr As OleDbDataReader = cmd.ExecuteReader
SuccessRegister.ShowDialog()
Profile.Show()
Me.Hide()
End Sub
End Class