Multiple ANDs

Multiple ANDs

Post by thsma » Mon, 22 Sep 2008 08:19:00


Here is the query;
strSQL = ("SELECT * FROM bills WHERE sessionID = " & ThisSession & "
AND filename = '" & ThisFile & "' AND size = '" & ThisSize & "'")


sessionID is a number, filename is a string, size is also a string.

I'm getting this error "error '80004005'"

It is failing at this line of code

rsShopper.Open strSQL, adoCon

If I take out one of the AND conditions it works fine but obviously
that isn't what I want to do.

This is running from an asp page connecting to an Access mdb.

Here are the relevant lines of code;

strSQL = ("SELECT * FROM bills WHERE sessionID = " & ThisSession & "
AND filename = '" & ThisFile & "' AND size = '" & ThisSize & "'")

rsShopper.CursorType = 2

rsShopper.LockType = 3

rsShopper.Open strSQL, adoCon


Any help will be appreciated.

Bernie
 
 
 

Multiple ANDs

Post by Sylvain La » Mon, 22 Sep 2008 09:22:39

You should display the result of the strSQL in a message box or to the
debug/immediate window (using Debug.Print) in order to see what's wrong with
it. One possibility would be that the value of either the filename or the
size has one or more single quote embedded in it or that the value of
ThisSession is null (ie., empty).

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)

 
 
 

Multiple ANDs

Post by thsma » Mon, 22 Sep 2008 11:46:46

Thanks for the reply. I figured out a workaround that allows me to get
on with the project.

However, excuse my ignorance, what IDE would I need to be using to
have a debug/immediate window? I'm using Notepad 2 and while it color
codes fine it doesn't have such wondrous things.

Bernie


On 21 Sep, 01:22, "Sylvain Lafontaine" <sylvain aei ca (fill the
 
 
 

Multiple ANDs

Post by Sylvain La » Mon, 22 Sep 2008 12:03:15

Maybe the same IDE as the one you're using for executing these pieces of
VB/VBA/VBScript code?

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
 
 
 

Multiple ANDs

Post by thsma » Mon, 22 Sep 2008 21:31:31

That would be the actual site on the server.

Bernie

On 21 Sep, 04:03, "Sylvain Lafontaine" <sylvain aei ca (fill the
 
 
 

Multiple ANDs

Post by Sylvain La » Tue, 23 Sep 2008 02:10:47

Ah, now we know that you are executing the pieces of code on a web server.
As you are testing/developping your application, nothing forbid you to add
the value of strSQL to the output of HTML code; for example with:

Response.Write sqlString & "<br>"
Response.Flush

' Uncomment the following line to stop the execution of the rest of the
page.
' Response.End


If your sqlString has special characters, you can choose to encode it:

Response.Write Server.HTMLEncode (sqlString) & "<br>"

With some IDEs like Visual Studio, Visual Interdev or Visual Studio.NET,
it's possible to put the web site into debug mode; even sometimes when the
web site is not local. Of course, this is all a configuration problem and I
don't know what your situation is for this web site.

Finally, for classic ASP, a better newsgroup to post this kind of question
would have be:

microsoft.public.inetserver.asp.db
microsoft.public.inetserver.asp.general

m.p.inetsdk.programming.scripting.vbscript could also be of interest to you.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
 
 
 

Multiple ANDs

Post by thsma » Tue, 23 Sep 2008 06:01:36

Thanks. That is the kind of thing I've been doing. The site hasn't
gone live yet so I can do this with safety. This is a seat of the
pants one man in his home office type of operation.

Thanks again for your help.

Bernie


On 21 Sep, 18:10, "Sylvain Lafontaine" <sylvain aei ca (fill the