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)
 what operator is missing here?
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 25 August 2003 :  13:29:06  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Replace the following code (lines 57-61):
strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, Chall_spot, DEFENDER, Def_spot, SCENARIO, EQUIP,"
if strStartDate <> "" then strSql = strSql & "START_DATE") VALUES &_
"('" & request.form("TYPE") & "','" & request.form("CHALLENGER") & "','" & thisChallenger("ladder_spot") & "'" &_
"'" & request.form("DEFENDER") & "','" & thisDefender("ladder_spot") & "','" & request.form("SCENARIO") & "','" & thisEQUIP("EQUIP") & "',"
if strStartDate <> "" then strSql = strSql & "#" & request.form("START_DATE") & "#"');"

with the following code:
strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, CHALL_SPOT, DEFENDER, DEF_SPOT, SCENARIO, EQUIP"
if strStartDate <> "" then strSql = strSql & ", START_DATE"
strSql = strSql & ") VALUES " & _
"('" & request.form("TYPE") & "', '" & request.form("CHALLENGER") & "', '" & thisChallenger("ladder_spot") & "'" &_
"'" & request.form("DEFENDER") & "', '" & thisDefender("ladder_spot") & "', '" & request.form("SCENARIO") & "', '" & thisEQUIP("EQUIP") & "',"
if strStartDate <> "" then strSql = strSql & "'#" & request.form("START_DATE") & "#"'"
strSql = strSql & ");"


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 - 25 August 2003 :  14:46:20  Show Profile  Visit Alfred's Homepage
Did.
What the response.write strSql showed was this:
quote:

INSERT INTO GAMES (TYPE, CHALLENGER, CHALL_SPOT, DEFENDER, DEF_SPOT, SCENARIO, EQUIP, START_DATE) VALUES ('Ladder Duel', 'Alpha Wolf', '41''Avenger', '6', 'Advance on St Lo', 'SSI','#7/7/01#);
which seems just fine.
But when I took out the response.write I got an error again:
quote:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in string in query expression ''#7/7/01#);'.
/BG/forums/Admin_Games_AddGame_handler.asp, line 74

(line 74 is the execute line)

Alfred
The Battle Group
CREDO
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 25 August 2003 :  14:52:40  Show Profile  Visit D3mon's Homepage
Looks like you've got no comma after '41' and no single quote after the last date.


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 25 August 2003 :  15:38:26  Show Profile  Visit Alfred's Homepage
Changed that, and it response.writes this now (new data):
quote:
INSERT INTO GAMES (TYPE, CHALLENGER, CHALL_SPOT, DEFENDER, DEF_SPOT, SCENARIO, EQUIP, START_DATE) VALUES ('Ladder Duel', 'Avenger','6',''Rommel','1','Anzio (1944)','RSF','#7/7/01#')
But without response.end it still gives the error:
quote:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression '''Rommel','1','Anzio (1944)','RSF','#7/7/01#')'.
/BG/forums/Admin_Games_AddGame_handler.asp, line 74
txt file: http://www.ggholiday.com/bg/forums/admin_games_addgame_handler.txt

Why would the Defender (Rommel) have a " before the name instead of '?

Alfred
The Battle Group
CREDO

Edited by - Alfred on 25 August 2003 15:41:58
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 25 August 2003 :  16:29:02  Show Profile  Visit D3mon's Homepage
you are generating a single quote after this code:

'" & thisChallenger("ladder_spot") & "','" &_

then adding one in before this code on the next line:

"'" & request.form("DEFENDER") & "','"

remove either one to fix the problem.
Seriously, these typos won't occur so easily if your code is lay out correctly, take my advice.


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 25 August 2003 :  16:35:02  Show Profile  Visit D3mon's Homepage
Consider again this revised code for lines 60 - 80:

strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, CHALL_SPOT, DEFENDER, DEF_SPOT, SCENARIO, EQUIP"

if strStartDate <> "" then
	strSql = strSql & ", START_DATE"
end if

strSql = strSql & ") VALUES (" & _
"'" & request.form("TYPE") & "'," & _
"'" & request.form("CHALLENGER") & "'," & _
"'" & thisChallenger("ladder_spot") & "'," & _
"''" & request.form("DEFENDER") & "'," & _
"'" & thisDefender("ladder_spot") & "'," & _
"'" & request.form("SCENARIO") & "'," & _
"'" & thisEQUIP("EQUIP") & "'," & _

if strStartDate <> "" then
	strSql = strSql & "'#" & request.form("START_DATE") & "#'"
end if

strSql = strSql & ")"

how easy it would be to see if there was an extra quote in there now? (there is, its red)


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"

Edited by - D3mon on 25 August 2003 16:39:31
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 25 August 2003 :  17:04:49  Show Profile  Visit Alfred's Homepage
I took that out now, and get this error:
quote:
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/BG/forums/Admin_Games_AddGame_handler.asp, line 63
if strStartDate <> "" then

updated: http://www.ggholiday.com/bg/forums/admin_games_addgame_handler.txt

Alfred
The Battle Group
CREDO

Edited by - Alfred on 25 August 2003 17:07:27
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 25 August 2003 :  17:13:30  Show Profile  Visit D3mon's Homepage
Ok, take this ( & _ ) off the end of here:

"'" & thisEQUIP("EQUIP") & "'," & _

do you see why this caused an error?


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 25 August 2003 :  18:05:20  Show Profile  Visit Alfred's Homepage
Yes.
Now I got this:
quote:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Extra ) in query expression 'M_NAME = 'Rommel') VALUES ('Ladder Duel','Avenger','6','Rommel','1','Anzio (1944)','RSF','#7/7/01#')'.
/BG/forums/Admin_Games_AddGame_handler.asp, line 72

Funny thing is if I take out the "extra )" the error states "missing )"!
SO what to do?

Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 25 August 2003 :  18:26:07  Show Profile
Are you sure the current text file is the same as your ASP file ?? ... I can't even see the INSERT INTO GAMES any more.

Can you do what you were doing before ?? .. EVERY time you post include a txt link, the Response.WRite output and the error you are getting. PLEASE include all 3 in every post.
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 25 August 2003 :  18:41:33  Show Profile  Visit Alfred's Homepage
Yes, they are the same, but I just noticed now that I missed to copy the first line od D3mon's code, which is the "INSERT INTO GAMES" part!
txt file: http://www.ggholiday.com/bg/forums/admin_games_addgame_handler.txt
response.write output I can't get now, but this error instead:
quote:
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/BG/forums/Admin_Games_AddGame_handler.asp, line 69
if strStartDate <> "" then


Alfred
The Battle Group
CREDO
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 25 August 2003 :  18:48:33  Show Profile
AT the end of line 67 remove this

& _

so line 67 should now look like :

"'" & thisEQUIP("EQUIP") & "',"
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 25 August 2003 :  19:13:28  Show Profile  Visit Alfred's Homepage
Done.

response.write strSql:
quote:
INSERT INTO GAMES (TYPE, CHALLENGER, CHALL_SPOT, DEFENDER, DEF_SPOT, SCENARIO, EQUIP, START_DATE) VALUES ('Ladder Duel','Avenger','6','Rommel','1','Anzio (1944)','RSF','#7/7/01#'
new error:
quote:
Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/BG/forums/Admin_Games_AddGame_handler.asp, line 78


[/quote]txt file: http://www.ggholiday.com/bg/forums/admin_games_addgame_handler.txt

Alfred
The Battle Group
CREDO

Edited by - Alfred on 25 August 2003 19:19:44
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 25 August 2003 :  19:28:20  Show Profile
Alfred, look at the response.write ... see what's missing? Also, you have single quotes are your date fields ... single quotes are used only for text values.

However, when I look at your text file, I don't see how you are even getting a response.write as you've commented it out.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~

Edited by - Nikkol on 25 August 2003 19:29:20
Go to Top of Page

Alfred
Senior Member

USA
1527 Posts

Posted - 25 August 2003 :  19:50:14  Show Profile  Visit Alfred's Homepage
No, Nikkol, I can't see what's missing - there are 8 fields, and 8 variables.
I commented the response.write only after I ran it, so I could see the error msg.
Anyway, taking out the single quotes around the date variable did finally peoduce the desired result!
I think I had tried that before, since I remember similar "data type mismatch" problems from the past. There were probably other things wrong then as well, and I try to always change one thing at a time only.
Thanks a lot - this was a stubborn one!

Alfred
The Battle Group
CREDO
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | Next Page
 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.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07