|
| |
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
Using ASP in my SQL query - 6/9/2002 20:32:07
Hi All: In a previous thread RDouglass gave a wonderful explanation of incorporating ASP into a SQL query. This would allow me to use "AND" as my joiner between variables while at the same time remove the need to use defaults. <% DIM mySQL mySQL = "" IF Request.Form(field1) > "" THEN mySQL = mySQL & "field1 = " & Request.Form(field1) END IF IF Request.Form(field2) > "" THEN IF mySQL > "" THEN mySQL = mySQL & " AND " END IF mySQL = mySQL & "field2 = " & Request.Form(field2) END IF ... ... %> This worked great after some tweaking. THEN I TRIED A RESULTS SET GREATER THAN 1 PAGE!!! Page 1 worked, the rest of the pages didn't. SQL error message. It seemed that that the variable was not being carried over to page 2 on up. Database Results Error Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'AND'. Number: -2147217900 (0x80040E14) Source: Microsoft OLE DB Provider for ODBC Drivers Before I give up on this (as I did all the work already), am I fighting a losing battle? CAN THIS WORK when results are more than one page long? All help appreciated!!!! http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
|
|
|
|
rdouglass
Posts: 9270 From: Biddeford, ME USA Status: offline
|
RE: Using ASP in my SQL query - 6/10/2002 9:38:16
Ya know, I have been looking at this and thinking about it some. I do have a page that uses the FP first/next/prev/last buttons and it does work using the type of script we worked on. I have posted the complete code here: http://www.clarkinsurance.com/hzarabet.htm Take a look and see if anything jumps out at you. The part you're probably interested in is the last DRW. The first 3 just are drop-downs. This page does work as 'advertised' - the buttons do work without the error you spoke of. My environment is FP2000, WinNT 4.0, IIS 4, FPExt 2000, Access 2000 DB. Hope it helps...
|
|
|
|
hzarabet
Posts: 1540 From: New Milford CT USA Status: offline
|
RE: Using ASP in my SQL query - 6/10/2002 23:06:40
It worked! But it blew something else out!!! Here is why it worked... Instead of: IF Request.Form("Sport") <> "" THEN IF search <> "" THEN search = search & " AND " END IF search = search & "Sport = '::Sport::'" END IF I was using: IF Request.Form("Sport") <> "" THEN IF search <> "" THEN search = search & " AND " END IF search = search & "Sport = '"&Request.Form("Sport")&"'" END IF That made the difference... Thank you RDouglass for staying with me on this one! I will start a new thread for what it blew out!!! http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada Edited by - hzarabet on 06/10/2002 23:07:19 Edited by - hzarabet on 06/10/2002 23:11:40
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|