Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Can you spot the syntax error?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Alfred
Senior Member

USA
1527 Posts

Posted - 20 August 2003 :  15:17:20  Show Profile  Visit Alfred's Homepage
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  Show Profile
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
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 20 August 2003 :  15:39:48  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
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")

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 20 August 2003 :  15:52:37  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
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
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 20 August 2003 :  17:08:17  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 20 August 2003 :  17:11:12  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 20 August 2003 :  17:21:22  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 20 August 2003 :  17:45:21  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
You don't need the second condition as it's already included in the first one.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 20 August 2003 :  17:54:29  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 20 August 2003 :  17:55:57  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Have you tried the code I posted above?

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz

Edited by - OneWayMule on 20 August 2003 17:56:37
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 20 August 2003 :  18:19:26  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 20 August 2003 :  18:24:59  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Try this: (removed the second WHERE)
strSQL = "UPDATE FORUM_MEMBERS SET LADDER_SPOT = LADDER_SPOT + 1 WHERE LADDER_SPOT >= " & intVictor("LADDER_SPOT") & " AND M_NAME <> '" & totalGame("CHALLENGER") & "'"

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 20 August 2003 :  18:38:04  Show Profile  Visit Alfred's Homepage
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
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 20 August 2003 :  18:42:15  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
You're welcome, I'm glad it works

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.35 seconds. Powered By: Snitz Forums 2000 Version 3.4.07