Hi, guys. How are you?
I have been having problem of updating data.
Error message said:
quote:
Syntax error (comma) in query expression 'Wine_Winery.[WineID] =9, 9 AND Wine_Winery.[WineryID] =85, 85'./hiroki/01.WinePro/ASP/Wine_edit2.asp, line 21
I was thinking of why those wineID and WineryId, each of those are repeating itself. Actually line 21 is my main SQL. I mean I did like belowe:
code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This file is from wine_list.asp so that if it doesn't come from there, just die
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
WineID = Request("WineID")
If WineID = "" Then
Response.End
End If
WineryID = Request("WineryID")
If WineryID = "" Then
Response.End
End IF
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'End of checking if it is from wine_list.asp or not.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Here is SQL statement which show data only wineID and WineryID are match with
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim sql_start
sql_start = "SELECT * FROM Wine_Winery WHERE Wine_Winery.[WineID] ="&WineID&" AND Wine_Winery.[WineryID] ="&WineryID&""
'sql_start = "SELECT * FROM Wine_Winery WHERE Wine_Winery.WineID ="&WineID&" AND Wine_Winery.WineryID ="&WineryID&""
'sql_start = "SELECT * FROM Wine_Winery WHERE WineID ="&WineID&" AND WineryID ="&WineryID&""
rs.Open sql_start, conn
'Check SQL statement if those reapteating number appears or not
''''''''''''''''''''''''''
'I was making vearisous sql statement above.
'Response.write(sql_start)
''''''''''''''''''''''''''
If Request.Form("action") = "Save" Then
'response.write(sql)
Update_Record
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This is Sub to do update
'It will update data only where WineID and WineryID are matched
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Update_Record()
WineID = Request.Form("WineID")
sql = "UPDATE Wine_Winery SET "
sql = sql & "Price='" & Request.Form("Price") & "',"
sql = sql & "Cuisine='" & Request.Form("Cuisine") & "'"
sql = sql & "WHERE Wine_Winery.[WineID]="&WineID&" AND Wine_Winery.[WineryID]="&WineryID
conn.Execute sql, RecordsAffected
End Sub
I tried to print sql statement, which actually does updata not sql_start. But couldn't do it properly.
Just error pops up like above.
Please help me.
Hiroki Kozai