Author |
Topic  |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 20 August 2003 : 15:17:20
|
Every so often I simply don't succeed in ending the statements properly:
quote: Microsoft VBScript compilation (0x800A0401) Expected end of statement /BG/forums/Admin_Games_update_handler.asp, line 60, column 145 strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = ladder_spot +1 WHERE LADDER_SPOT = " & intVictor("LADDER_SPOT") or LADDER_SPOT > " & intVictor("LADDER_SPOT")"'"
All "ladder_spot" fields are number fields in my MS Access db. Can you please tell me what I did wong here?
(edited field type) |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 20 August 2003 17:12:30 |
|
altisdesign
Junior Member
 
United Kingdom
357 Posts |
Posted - 20 August 2003 : 15:25:48
|
When you close the speech mark and put in the intVictor you must reopen them again before carrying on with the SQL statement eg.
strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = '" & ladder_spot +1 & "' WHERE LADDER_SPOT >= '" & intVictor("LADDER_SPOT")& "'" |
Altis Design offers all manner of web design services to a variety of commercial and personal clients |
Edited by - altisdesign on 20 August 2003 15:40:42 |
 |
|
OneWayMule
Dev. Team Member & Support Moderator
    
Austria
4969 Posts |
|
davemaxwell
Access 2000 Support Moderator
    
USA
3020 Posts |
Posted - 20 August 2003 : 15:52:37
|
quote: Originally posted by OneWayMule
Personally, I'd change the field type to integer and use the following code:
strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = LADDER_SPOT+1 WHERE LADDER_SPOT >= " & intVictor("LADDER_SPOT")
This is what I would use as well. Much more efficient. |
Dave Maxwell Barbershop Harmony Freak |
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 20 August 2003 : 17:08:17
|
quote: Originally posted by altisdesign
When you close the speech mark and put in the intVictor you must reopen them again before carrying on with the SQL statement eg.
strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = '" & ladder_spot +1 & "' WHERE LADDER_SPOT >= '" & intVictor("LADDER_SPOT")& "'"
You mean like this?: quote: strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = '" & ladder_spot +1 & "' WHERE LADDER_SPOT >= '" & intVictor("LADDER_SPOT")& " or LADDER_SPOT = '" & intVictor("LADDER_SPOT")& "'"
BTW, in my first quote I missed that it did not paste the whole statement. The "or" should specify the condition also when it equals intVictor("ladder_spot"). |
Alfred The Battle Group CREDO
|
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 20 August 2003 : 17:11:12
|
quote: Originally posted by OneWayMule
Personally, I'd change the field type to integer and use the following code:
strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = LADDER_SPOT+1 WHERE LADDER_SPOT >= " & intVictor("LADDER_SPOT")
I am sorry, they actually ARE number fields, anyway. |
Alfred The Battle Group CREDO
|
 |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 20 August 2003 : 17:21:22
|
This part (with only the first condition) works ok:quote: strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = '" & ladder_spot +1 & "' WHERE LADDER_SPOT >= '" & intVictor("LADDER_SPOT")
I can't end the statement properly when I add the second condition: quote: strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = '" & ladder_spot +1 & "' WHERE LADDER_SPOT >= '" & intVictor("LADDER_SPOT")& " or LADDER_SPOT = '" & intVictor("LADDER_SPOT")& "'"
I also tried with "cint", and with all combinations of "" at the end, but keep getting the "expected end of statement" error! quote: strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = '" & ladder_spot +1 & "' WHERE LADDER_SPOT >= '" & intVictor("LADDER_SPOT")& "' or LADDER_SPOT = Cint( & intVictor("LADDER_SPOT")""
|
Alfred The Battle Group CREDO
|
Edited by - Alfred on 20 August 2003 17:51:14 |
 |
|
OneWayMule
Dev. Team Member & Support Moderator
    
Austria
4969 Posts |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 20 August 2003 : 17:54:29
|
quote: Originally posted by OneWayMule
You don't need the second condition as it's already included in the first one.
I see. I did suspect that the >= means as much, but it gave me the same number for the player where a 1 should have been added!
|
Alfred The Battle Group CREDO
|
 |
|
OneWayMule
Dev. Team Member & Support Moderator
    
Austria
4969 Posts |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 20 August 2003 : 18:19:26
|
Yes, sure did. Like I said, it works ok, but assigns the same number to both players. SO I thought I make a second condition, excluding the "Challenger" from the addition of 1 :quote: strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = LADDER_SPOT + 1 WHERE LADDER_SPOT >= " & intVictor("LADDER_SPOT") & " and where M_NAME <> '" & totalGame("CHALLENGER") & "'"
But then I get this error: quote: Error Type: Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression 'LADDER_SPOT >= 4 and where M_NAME <> 'Alpha Wolf''. /BG/forums/Admin_Games_update_handler.asp, line 61
|
Alfred The Battle Group CREDO
|
 |
|
OneWayMule
Dev. Team Member & Support Moderator
    
Austria
4969 Posts |
|
Alfred
Senior Member
   
USA
1527 Posts |
Posted - 20 August 2003 : 18:38:04
|
Great, that was it! Interestingly, this is what I had earlier, but I guess there were other problems why it didn't work then...
Thanks, Mule, now I can do some more testing with it. |
Alfred The Battle Group CREDO
|
 |
|
OneWayMule
Dev. Team Member & Support Moderator
    
Austria
4969 Posts |
|
|
Topic  |
|