Forum Moderators: open

Message Too Old, No Replies

help a newbie?

syntax error problem

         

leezard

7:21 am on Apr 5, 2003 (gmt 0)

10+ Year Member


I'm new to ASP and trying to set up a website for an oline game. I'm having a problem with syntax errors. This is the page in question.
http://www.doyoueverwonder.com/forum/custom/Characters.asp?GuildList=1

and if you click on anything under "first name" "level" "class" or "race" it gives this error.

Microsoft JET Database Engine error '80040e14'

Syntax error in string in query expression '[CharID]='2;'.

/forum/custom/Characters.asp, line 59

The char Id # changes of course depending on which name you click.

and this is the code in question that i believe is causing the problem.

<td class="messagecellbody<%=sClass%>" valign=top onmouseover="this.style.cursor = 'hand'" onmouseout="this.style.cursor = 'default'" onclick="window.location='Characters.asp?action=CharInfo&sCharID=<%=CharID%>'">
<%=rsMaster("Char_Level")%>

if anyone could point me in the right direction on how to fix this I would be forever in your debt.

BradleyT

8:04 am on Apr 5, 2003 (gmt 0)

10+ Year Member



It looks to me like it's an apostrophe problem.

""Syntax error in string in query expression '[CharID]='1;'. ""

So when you're building your SQL statement an apostrophe (') is getting put in wrong.

[CharID]='1' is how it should look. Take a look at where your ; is being put in. Switch around the ;' to '; and you should be fine!

leezard

10:23 am on Apr 5, 2003 (gmt 0)

10+ Year Member



hmm ok, i found where the apostrophe was misplaced. But now I'm getting this error.

Microsoft JET Database Engine error '80040e07'

Data type mismatch in criteria expression.

/forum/custom/Characters.asp, line 59

BradleyT

5:11 pm on Apr 5, 2003 (gmt 0)

10+ Year Member



Comment out your execute statement and put in this:

Response.Write("SQL IS: " & SQL)

Where SQL is the variable name that you use to build your query.

Then post the result of that Response.Write here.

WebJoe

10:57 am on Apr 6, 2003 (gmt 0)

10+ Year Member



Looks to me as if the "CharID" in your database is of type numer, integer or something other numeric (though float wouldn't make much sense), but your SQL-statement looks for a string...try to get rid of the ':


[CharID]=1

instead of

[CharID]='1'