Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / April 2007



Tip: Looking for answers? Try searching our database.

Need ASP help!!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rae Kim - 14 Apr 2007 16:13 GMT
Hi,

I am trying to use ASP in html to retrieve and display data from an MS
Access database. I keep getting this error:

Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'PersonID='.

In relation to the following line of code in ASP:

strSQL = "SELECT * FROM Person WHERE PERSONID= " & Session("PersonID")

Can you please tell me what the missing operator is? I have tried
adding in parenthesis and nothing seems to work, and I do not see what
is wrong with the code.

Thank you!!!
Evertjan. - 14 Apr 2007 16:56 GMT
Rae Kim wrote on 14 apr 2007 in microsoft.public.inetserver.asp.db:

> Hi,
>
[quoted text clipped - 8 lines]
>
> strSQL = "SELECT * FROM Person WHERE PERSONID= " & Session("PersonID")

Do:

' vbs
reponse.write strSQL
reponse.end

What do you see?

> Can you please tell me what the missing operator is? I have tried
> adding in parenthesis and nothing seems to work, and I do not see what
> is wrong with the code.
>
> Thank you!!!

Signature

Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

PW - 15 Apr 2007 12:43 GMT
You need single-quotes around the PersonID value.

Instead of this ...
strSQL = "SELECT * FROM Person WHERE PERSONID= " & Session("PersonID")

It should be this ...
strSQL = "SELECT * FROM Person WHERE PERSONID= '" & Session("PersonID") &
"'"
Bob Barrows [MVP] - 15 Apr 2007 13:36 GMT
> You need single-quotes around the PersonID value.
>
[quoted text clipped - 4 lines]
> strSQL = "SELECT * FROM Person WHERE PERSONID= '" &
> Session("PersonID") & "'"

How do you know that? You're assuming PERSONID is a character field ... ?
Signature

Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Bob Barrows [MVP] - 15 Apr 2007 13:38 GMT
> Hi,
>
[quoted text clipped - 14 lines]
>
> Thank you!!!

We cannot debug a sql statement without knowing what it is. Showing us the
vbscript code that is supposed to generate the sql statement is only half
the battle. Put the following statements into your code right after the
above line of code, run the page and show us the result. Actually, you will
probably see the problem yourself when you do that.

response.write sql
response.end

Signature

Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Daniel Crichton - 17 Apr 2007 17:08 GMT
Rae wrote  on 14 Apr 2007 08:13:58 -0700:

> Hi,
>
[quoted text clipped - 14 lines]
>
> Thank you!!!

From that error, I'd say Session("PersonID") is blank.

Dan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.