By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 1,989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

Help Me :SYNTAX ERROR: INSERT INTO STMT (at line cmd.ExecuteNonQuery())

P: 7
Expand|Select|Wrap|Line Numbers
  1. 'Register User Form
  2. Imports System.Data.OleDb
  3. Public Class RegisterUser
  4.        ‘ Variables Decleration
  5.        Public Con As OleDbConnection
  6.        Public Cmd As OleDbCommand
  7.        Public Dr As OleDbDataReader
  8.        Public Da As OleDbDataAdapter
  9.        Dim Email_id As Object
  10. 'TextBox(EmployeeID.Click)
  11.     TBEmpID.Text = Trim(TBEmpID.Text)
  12. End Sub
  13. 'TextBox(EmailName.Click)
  14.     TBEmailName.Text = Trim(TBEmailName.Text)
  15. End Sub
  16. 'Button(BClear.Click)
  17.     TBEmpID.Text.Clear()
  18.        TBEmpName.Text.Clear()
  19.        TBEmailName.Text.Clear()
  20.        TBPass.Text.Clear()
  21.        TBCPass.Text.Clear()
  22.        CBDomain.Text.Clear()
  23. End Sub
  24. 'WindowControlButton(Help.Click) (?)
  25.     HelpForm.Show()
  26. End Sub
  27.  
  28.  
  29. 'Button(BRegister.Click)
  30. Try
  31.        Emailid = TBEmailName.Text & “” & CBDomain.Text
  32.        If(TBEmpID.Text = String.Empty or TBEmpName.Text = String.Empty or TBEmailName.Text = String.Empty or TBPass.Text = String.Empty or TBCPass.Text = String.Empty) then
  33.        MsgBox(“You Have miss to fill some fields”, MessageBox.Style = Exclamation)
  34.        Else
  35.         If(CBDomain.Text = String.Empty) then
  36.             MsgBox(“Kindly Select the domain of your email”, MessageBox.Style = Exclamation)
  37.        Else
  38.                If(TBPass.Text = TBCPass.Text)then
  39.                Con = New OleDbConnection(“Provider=Microsoft.ACE.OleDb.12.0; Data Source=DataBase\Dashbard.accdb; Presist Info Security = False”)
  40.                Con.Open()
  41.                Cmd = New OleDbCommand(“INSERT INTO EmpDatas(EmpID,Name,EmailID,Password) VALUES(‘” & TBEmpID.Text & ”’,’” & TBEmpName.Text & ”’ ,’” & Emailid & ”’ ,’” & TBPass.Text & ”’)”, Con)
  42.                Cmd.ExecuteNonQuery()
  43.        MsgBox(“Data Saved Successfully”, MessageBox.Style= Information)
  44.        Con.Close()
  45.             Else
  46.             MsgBox(“Password and ConfirmPassword is not matched. Please try again”, MessageBox.Style=Exclamation)
  47.             TBPass.Text.Clear()
  48.        TBCPass.Text.Clear()
  49.             End If
  50.        End If
  51.        End If
  52. Catch ex As Exception
  53.        MsgBox(ex.Message)
  54. End Try
  55. EntryForm.Show()
  56. Me.Close
  57. End Sub
  58. End Class
  59.  
  60.  
Jul 5 '11 #1
Share this Question
Share on Google+
2 Replies


MrMancunian
Expert 100+
P: 569
See line 39: "Presist" should be "Persist". If that's not the problem, please post the full error message.

Steven
Jul 7 '11 #2

P: 7
Hi MrMancunian,
I will try your solution. Thanks for reply
Jul 7 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.