guys help my code is failing to run its showing syntax error in insert into statement when i debug

  • Thread starter Thread starter teee2396
  • Start date Start date
T

teee2396

Guest
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
dataFile = "C:\Users\achikanya\Desktop\xray database.accdb"
connString = provider & dataFile
myConnection.ConnectionString = connString
myConnection.Open()
Dim str As String
str = "Insert into Patient Details([National ID],[First Name],[Last Name],[Phone number],,[Procedure],[Gender],[Address],[Date]) Values (?????????))"
Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection)
cmd.Parameters.Add(New OleDbParameter("National ID", CType(TextBox1.Text, String)))
cmd.Parameters.Add(New OleDbParameter("First Name", CType(TextBox2.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Last Name", CType(TextBox3.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Phone number", CType(TextBox4.Text, String)))
cmd.Parameters.Add(New OleDbParameter("(Email", CType(TextBox5.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Procedure", CType(TextBox6.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Gender", CType(TextBox7.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Address", CType(TextBox8.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Date", CType(TextBox9.Text, String)))

[url="https://social.msdn.microsoft.com/Forums/en-US/256d872e-4934-43c5-8cb7-1318b288f6e9/guys-help-my-code-is-failing-to-run-its-showing-syntax-error-in-insert-into-statement-when-i-debug?forum=vbgeneral"]Continue reading...[/url]
 
Back
Top