rangerstud620
Active member
- Joined
- Jun 14, 2005
- Messages
- 27
Im trying to update a SQL db using ASP.NET but I keep getting the following error: "Line 1: Incorrect syntax near ?. Line 1: Incorrect syntax near ?."
Here is my code:
Can anyone see the problem? I keep thinking its a problem with the database but Im not sure.
Here is my code:
Code:
Dim di As DataListItem
Dim cmd As New SqlCommand("UPDATE YPVerification SET [MEMO] = ?, [STATUS] = ?, [DATE_VERIFIED] = ? WHERE IMG_ID = ?", objConnection)
Dim param As SqlParameter
Dim rbList as RadioButtonList = E.Item.FindControl("rbList")
Dim CurrDate as New DateTime()
CurrDate = DateTime.Now
Dim strCurrDate as String = CurrDate.ToString
di = E.Item
cmd.CommandType = CommandType.text
Update parameters
param = cmd.Parameters.Add("?", SqlDbType.Char)
param.Value = DirectCast(di.FindControl("txtMemo"), textbox).Text
If rbList.Items.FindByValue("Y").Selected = True then
param = cmd.Parameters.Add("?", SqlDbType.Char)
param.Value = "Y"
param = cmd.Parameters.Add("?", SqlDbType.Char)
param.Value = strCurrDate
Else
param = cmd.Parameters.Add("?", SqlDbType.Char)
param.Value = "N"
param = cmd.Parameters.Add("?", SqlDbType.Char)
param.Value = "N/A"
End If
param = cmd.Parameters.Add("?", SqlDbType.Int)
param.value = E.Item.ItemIndex + 1
Update database
cmd.Connection.Open()
cmd.ExecuteNonQuery() ***ERRORS HERE***
dataList.EditItemIndex = -1
cmd.Connection.Close()
Can anyone see the problem? I keep thinking its a problem with the database but Im not sure.
Last edited by a moderator: