S
Stephen
Hi,
I am trying to update a record in the DB and i am using OLEDB command and
connection.
I get this error while updating.
Error inserting data: System.Data.OleDb.OleDbException: Syntax error in
UPDATE statement.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at Customer.InventoryDatabase.UpdateLogin(String uNamee, String pwde,
String accesse) in
C:\Inetpub\wwwroot\HP\Customer\Management\InventoryDatabase.vb:line 51\r\n
Can anyone please suggest what this means,
this is my function that I an using to update the database (MS access)
Public Function Update(ByVal uName As String, ByVal pwd As String, ByVal
access As String) As Boolean
Dim CmdText As String = "UPDATE Login SET Password=@Password,
Access=@Access WHERE UName=@UName"
Dim cmd As New OleDbCommand(CmdText, conn)
Try
cmd.CommandType = CommandType.Text
cmd.CommandType = CommandType.Text
Dim pms As OleDbParameterCollection = cmd.Parameters
pms.Add("@UName", OleDbType.VarChar, 15)
pms.Add("@Password", OleDbType.VarChar, 15)
pms.Add("@Access", OleDbType.VarChar, 5)
pms("@UName").Value = uName
pms("@Password").Value = pwd
pms("@Access").Value = access
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Return True
Catch ex As Exception
logFile.LogOutput("Error inserting data: " + ex.ToString())
Return False
End Try
End Function
Thanks,
Stephen
I am trying to update a record in the DB and i am using OLEDB command and
connection.
I get this error while updating.
Error inserting data: System.Data.OleDb.OleDbException: Syntax error in
UPDATE statement.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at Customer.InventoryDatabase.UpdateLogin(String uNamee, String pwde,
String accesse) in
C:\Inetpub\wwwroot\HP\Customer\Management\InventoryDatabase.vb:line 51\r\n
Can anyone please suggest what this means,
this is my function that I an using to update the database (MS access)
Public Function Update(ByVal uName As String, ByVal pwd As String, ByVal
access As String) As Boolean
Dim CmdText As String = "UPDATE Login SET Password=@Password,
Access=@Access WHERE UName=@UName"
Dim cmd As New OleDbCommand(CmdText, conn)
Try
cmd.CommandType = CommandType.Text
cmd.CommandType = CommandType.Text
Dim pms As OleDbParameterCollection = cmd.Parameters
pms.Add("@UName", OleDbType.VarChar, 15)
pms.Add("@Password", OleDbType.VarChar, 15)
pms.Add("@Access", OleDbType.VarChar, 5)
pms("@UName").Value = uName
pms("@Password").Value = pwd
pms("@Access").Value = access
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Return True
Catch ex As Exception
logFile.LogOutput("Error inserting data: " + ex.ToString())
Return False
End Try
End Function
Thanks,
Stephen