Posted on 2013-05-14
Medium Priority
Last Modified: 2013-05-16
ASP VBScript
MS Access

Hello, all.

I have, what I thought was, a simple SELECT statement that works just fine inside of MS Access; however, it is not working when I paste it into my ASP script.

Here is the statement inside Access:
select * from cp_parts where cp_image is not null and cp_image <>""""

Here it is inside my ASP script/connection area:

Set objRs=Server.CreateObject("ADODB.RecordSet")

strsql="select * from cp_parts where cp_image is not null and cp_image <>"""" "
objRs.Open strsql, objConn, 0, 1, 1

I simply pasted it inside the quotes and it give me a message that it is "... expecting 1 or more parameters...".

What am I doing wrong?

Thank you!
Question by:lshane
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 33

Expert Comment

by:Big Monty
ID: 39166260
there looks to be an extra space in the sql, was that just a typo?

strsql="select * from cp_parts where cp_image is not null and cp_image <>"""" "

Author Comment

ID: 39166318
No, there is just a single space there.

Here is the actual message I get when I run the page:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/pmcct2/copyimages.asp, line 11

Line 11 is this line:  objRs.Open strsql, objConn, 0, 1, 1

It works fine if I just leave it as:  select * from cp_parts where cp_image is not null

... but... there are other fields that are blank, but considered "empty", I guess.  (Something to do with Access)... thus the "AND" portion of it.

Like I said - it runs fine inside of Access.
Doesn't seem to be translating outside of Access.
LVL 33

Expert Comment

by:Big Monty
ID: 39166364
did you try putting brackets around the field names?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 39166425
Just tried that... same problem.  No effect.
LVL 41

Expert Comment

ID: 39166644
Did you try this?

strsql="select * from cp_parts where cp_image is not null and cp_image <>'' "

Author Comment

ID: 39168055
Hi, Sharath.

Bummer - no go, either.

I have no idea what the deal could be.
LVL 33

Expert Comment

by:Big Monty
ID: 39168274
let's try another approach, as what you have looks like it should work...

try this:

strsql="select * from cp_parts where cp_image is not null and Len( [cp_image] & """" ) = 0"
LVL 82

Accepted Solution

hielo earned 2000 total points
ID: 39171758
strsql="select * from cp_parts where (cp_image is not null) and (cp_image <>'') "

Open in new window


Author Closing Comment

ID: 39172207
Hi, hielo.

Yours seemed to do the trick.


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question