This topic is locked

Need Help with SQL statement

6/30/2004 10:57:40 AM
ASPRunnerPro General questions
O
Oxygenthief author

Hey all,
I am having a bit of trouble with a simple SQL statement. No one in my office seems to know why it will not work so I hope someone here has some insight. Here is the statement.
I then take test1 and use it's value to send an email, here is the code I use to specify the value of the email:
[color=blue]test1.Fields("RequestingPOCEmail")
Here is the rundown...
When I use this statement inside the loop on the list page which displays data using rsData.Fields("ExtensionRequestName") it chokes on its first itiration of the loop. No errors are reported.... it just stops and appears to break out of the loop and displays the rest of the page without data.
The part that confuses me is that if I take the AND condition out of the statement and replace it with an OR it works. It also works if I take out either of the variables leaving only one to be executed. My test data is set up to make sure that there are several instances where the statement above would be true. Did I use the AND condition incorrectly?
Even if I try to debug the statement by using a response.write and try to display the value within test1 the loop terminates and no errors are given.
What gives?

Sergey Kornilov admin 6/30/2004

First of all I won't recommend to test SQL statements on the ASP page. You need to print exact SQL statement and run it against your database to see if there any errors. After you make sure it works fine you can use it on the ASP page.

O
Oxygenthief author 6/30/2004

And I am kind of new to ASP and SQL so if there is another way to test my sql statements besides on the ASP page itself I would really like to know. Any suggesions?
As far as making exact SQL statements, this was my origional question... Is my statement correct?

Sergey Kornilov admin 6/30/2004

There is no direct answer on "is this statement correct?" question. Depending on your database type and data answer will be different.
If you use MS Access you can create a new query in your database and copy&paste your SQL statement there to test it. If you use SQL Server you can do the same in SQL Server analyzer.