Author |
Topic |
Alfred
Senior Member
USA
1527 Posts |
Posted - 24 August 2003 : 17:38:04
|
quote: Error Type: Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression '''Avenger','6','Anzio (1944)','RSF',#7/7/02#)'. /BG/forums/Admin_Games_AddGame_handler.asp, line 64
this is the faulty code: quote: strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, DEFENDER, SCENARIO, EQUIP," if strStartDate <> "" then strSql = strSql & "START_DATE, " if strEndDate <> "" then strSql = strSql & "END_DATE, " strSql = strSql & "RESULT, VICTOR) VALUES " &_ "('" & request.form("TYPE") & "','" & request.form("CHALLENGER") & "'," &_ "'" & request.form("DEFENDER") & "','" & request.form("SCENARIO") & "','" & thisEQUIP("EQUIP") & "'," if strStartDate <> "" then strSql = strSql & "#" & request.form("START_DATE") & "#," if strEndDate <> "" then strSql = strSql & "#" & request.form("END_DATE") & "#," strSql = strSql & "'" & request.form("RESULT") & "','" & request.form("VICTOR") & "')" my_Conn.execute(strSql)
|
Alfred The Battle Group CREDO
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
D3mon
Senior Member
United Kingdom
1685 Posts |
Posted - 24 August 2003 : 18:17:38
|
Try adding in the characters in red:
if strStartDate <> "" then strSql = strSql & "'#" & request.form("START_DATE") & "#'," if strEndDate <> "" then strSql = strSql & "'#" & request.form("END_DATE") & "#'," |
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 24 August 2003 18:17:53 |
|
|
D3mon
Senior Member
United Kingdom
1685 Posts |
Posted - 24 August 2003 : 18:23:43
|
You'll find your code easier to debug if you give it some structure, for example:
strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, DEFENDER, SCENARIO, EQUIP,"
if strStartDate <> "" then
strSql = strSql & "START_DATE, "
end if
if strEndDate <> "" then
strSql = strSql & "END_DATE, "
end if
strSql = strSql & "RESULT, VICTOR) VALUES (" & _
"'" & request.form("TYPE") & "'," & _
"'" & request.form("CHALLENGER") & "'," & _
"'" & request.form("DEFENDER") & "'," & _
"'" & request.form("SCENARIO") & "'," & _
"'" & thisEQUIP("EQUIP") & "',"
if strStartDate <> "" then
strSql = strSql & "#" & request.form("START_DATE") & "#,"
end if
if strEndDate <> "" then
strSql = strSql & "#" & request.form("END_DATE") & "#,"
end if
strSql = strSql & "'" & request.form("RESULT") & "'," & _
"'" & request.form("VICTOR") & "')"
my_Conn.execute(strSql)
|
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 24 August 2003 18:24:59 |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 24 August 2003 : 19:20:52
|
quote: Originally posted by OneWayMule
Ummm... what are the # characters for?
In Access I need to put those # characters around date field variables to make them compatible. Also, they were part of the functional code before, and the error only came up when I added the two "ladder_spot" fields. |
Alfred The Battle Group CREDO
|
Edited by - Alfred on 24 August 2003 19:27:32 |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 24 August 2003 : 19:30:07
|
Alfred, you're forgetting the first rule again .... if the Execute fails, then (in this case) put a Response.Write strSql just before the Execute line. That should point you in the right direction.
D3mon's coding structure will help, but your error line will still be the Execute line. |
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 24 August 2003 : 21:54:11
|
Laser, the error line (64) actually is not the execue line but the one in red: quote: strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, DEFENDER, SCENARIO, EQUIP," if strStartDate <> "" then strSql = strSql & "START_DATE, " if strEndDate <> "" then strSql = strSql & "END_DATE, " strSql = strSql & "RESULT, VICTOR) VALUES " &_ "('" & request.form("TYPE") & "','" & request.form("CHALLENGER") & "'," &_ "'" & request.form("DEFENDER") & "','" & request.form("SCENARIO") & "','" & thisEQUIP("EQUIP") & "'," if strStartDate <> "" then strSql = strSql & "#" & request.form("START_DATE") & "#," if strEndDate <> "" then strSql = strSql & "#" & request.form("END_DATE") & "#," strSql = strSql & "'" & request.form("RESULT") & "','" & request.form("VICTOR") & "')" Response.Write strSql response.end my_Conn.execute(strSql)
I get the same error report now. |
Alfred The Battle Group CREDO
|
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 24 August 2003 : 22:06:46
|
however, the error that you first posted could only be from executing the sql. perhaps you should just post a link to a text version of that file. |
Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~ |
|
|
Alfred
Senior Member
USA
1527 Posts |
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 25 August 2003 : 00:48:24
|
OK, with the code you provided, line 64 has nothing to do with an Execute or thisEQUIP.
So using the code that you have provided in the txt file, try this :
Create a new line between lines 65 and 66 and insert :
Response.Write strSql
|
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 25 August 2003 : 00:57:14
|
Please disregard the original code I posted above. It does not contain my addition (in red here): quote: strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, Chall_spot, DEFENDER, Def_spot, SCENARIO, EQUIP," if strStartDate <> "" then strSql = strSql & "START_DATE, " if strEndDate <> "" then strSql = strSql & "END_DATE, " strSql = strSql & "RESULT, VICTOR) 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") & "#," if strEndDate <> "" then strSql = strSql & "#" & request.form("END_DATE") & "#," strSql = strSql & "'" & request.form("RESULT") & "','" & request.form("VICTOR") & "')" my_Conn.execute(strSql)
This error msg claims:
quote: Error Type: Microsoft JET Database Engine (0x80040E14) Number of query values and destination fields are not the same. /BG/forums/Admin_Games_AddGame_handler.asp, line 66
but I thought I added two for each side? 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 00:59:54 |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 25 August 2003 : 01:07:55
|
So where is the Response.Write before the Execute ??
I can't see what is wrong with your statement, but try a ; right at the end as in :
strSql = strSql & "'" & request.form("RESULT") & "','" & request.form("VICTOR") & "');"
|
|
|
Alfred
Senior Member
USA
1527 Posts |
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
Posted - 25 August 2003 : 11:17:59
|
quote: I did both things now, but still only get get an error msg.
Post the exact error message please. Also, change the red part in the following code
if strStartDate = "" and strEndDate = "" then
response.write "<center>You need to enter a date!"
else
strSql = "INSERT INTO GAMES (TYPE, CHALLENGER, Chall_spot, DEFENDER, Def_spot, SCENARIO, EQUIP,"
if strStartDate <> "" then strSql = strSql & "START_DATE, "
if strEndDate <> "" then strSql = strSql & "END_DATE, "
strSql = strSql & "RESULT, VICTOR) 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") & "#,"
if strEndDate <> "" then strSql = strSql & "#" & request.form("END_DATE") & "#,"
strSql = strSql & "'" & request.form("RESULT") & "','" & request.form("VICTOR") & "');"
Response.Write
'response.end
my_Conn.execute(strSql) to
Response.Write strsql
Response.End and post what the page displays.
|
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
|
|
|
Alfred
Senior Member
USA
1527 Posts |
Posted - 25 August 2003 : 12:18:25
|
This is what it displays: quote: Error Type: Microsoft VBScript compilation (0x800A0401) Expected end of statement /BG/forums/Admin_Games_AddGame_handler.asp, line 58, column 57 if strStartDate <> "" then strSql = strSql & "START_DATE") VALUES &_ --------------------------------------------------------^
|
Alfred The Battle Group CREDO
|
|
|
Topic |
|
|
|