Closed Thread Icon

Topic awaiting preservation: SQL update data problem(ASP) (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12992" title="Pages that link to Topic awaiting preservation: SQL update data problem(ASP) (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: SQL update data problem(ASP) <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-19-2003 09:28

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

Rhino
Bipolar (III) Inmate

From: New Jersey, USA
Insane since: Jul 2003

posted posted 11-19-2003 09:43

Check to see how the form values are being built. It looks like you are getting the values fine, so I would check how you get/set the WineID and WineryID in the FORM.

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-19-2003 20:35

Cheers.

Hiroki Kozai

« BackwardsOnwards »

Show Forum Drop Down Menu