Hi there, i got problem here when i try to run the update query. the msg box the error is "No value given for one or more required parameter for update query".
the query is
Dim strSQL As String = ("UPDATE [DailyReport] SET [Status] ='" & txtRepSta.Text & "' WHERE DailyID ='" & txtDailyRep.Text & "' ")
Dim cmd As OleDbCommand = New OleDbCommand(strSQL, OleDbConnection)
Dim objread As OleDbDataReader
objread = cmd.ExecuteReader
MsgBox("Update Success")
i have try to add more paremeter but the result still the same, "No value given for one or more required parameter for update query". There new query i try
Dim strSQL As String = ("UPDATE [DailyReport] SET [Status] ='" & txtRepSta.Text & "', [TimeRes] = '" & timeToday.Text & "' WHERE DailyID ='" & txtDailyRep.Text & "' AND PatientHp = '" & txtRecNo.Text & "' ")
Dim cmd As OleDbCommand = New OleDbCommand(strSQL, OleDbConnection)
Dim objread As OleDbDataReader
objread = cmd.ExecuteReader
MsgBox("Update Success")
Can anyone kindly advise me with this
Loading
BenjaminPosted May 28, 2010, 7:29 AM
some remarks. First of all you use a datareader to update...
If you have your command is enough to do cmd.executeNonQuery this executes your sql-statement, no reader needed(doesn't work by the way).
The error you get doesn't mean that you forgot some parameters, my guess you use column-names that aren't columns, that's why you get this error. Check if you columnnames are correct if not the sql sees them as a parameter.
Try this first with a short sql-statement(your first attempt).
Hope this helps.