What is wrong in following code?Give me solution
This is my code
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
myCommand = New OleDbCommand
myCommand.Connection = myConnection
Dim intPositin As Int16
intPositin = myCurrencyManager.Position
myCommand.CommandText = "insert into login (UserId, Password) values (@UserId, @Password)"
myCommand.Parameters.Add("@UserId", txtUserName.Text)
myCommand.Parameters.Add("@Password", txtPassword.Text)
myConnection.Open()
Try
myCommand.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
myConnection.Close()
FillDataSetAndView()
BindFields()
myCurrencyManager.Position = myCurrencyManager.Count
ShowPosition()
StatusBar1.Text = "Record Added"
Clear()
End Sub
I am using Try...Catch to catch exception.
I get Following exception
Syntax error in INSERT INTO statement
What is wrong with code.
if you have another code for inserting above values give me that code
|