Database using Access query - passing parameter (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


webcats -> Database using Access query - passing parameter (8/23/2003 22:22:56)

I'm using .asp pages to query an Access database using a query I created in Access (specified in the DRW). What I'd like to do is specify a parameter to limit the query's results. The query field that I'm using, AreaID should = the specific Website (there are about 12).

I tried creating the database results, then changing to HTML view and adding "WHERE AreaID=3" to the "s-sql=" and "fp_sQry=" parts, but I get an error: Too few parameters. Expected 1.
Number: -2147217904

I'd prefer not to use a Custom Query.

Anyone have any ideas? Thanks.




Spooky -> RE: Database using Access query - passing parameter (8/24/2003 1:40:55)

Can you post your fp_sQry string (from the red code)




webcats -> RE: Database using Access query - passing parameter (8/24/2003 16:04:51)

Hi, here it is: fp_sQry="SELECT * FROM qryPets WHERE AreaID=3"

Thanks.




Spooky -> RE: Database using Access query - passing parameter (8/24/2003 16:47:03)

Ahh, ok - you are using an Access query.
Its not something I have attempted to do via the DRW and believe its not possible (I may try it soon though!)
Typically youll do it via custom asp.

Reference this thread for example :
http://www.frontpagewebmaster.com/m_77788/tm.htm




webcats -> RE: Database using Access query - passing parameter (8/24/2003 17:02:33)

Yeah, I think you're right about it not being possible.

When I modify the "fp_sQry="SELECT * FROM qryPets" line to "fp_sQry="SELECT * FROM qryPets WHERE AreaID=3" then save... it goes back to the plain Select line. (I didn't notice that before...)

Now I gotta get out my ASP Databases book and start reading!

Thanks anyway.




BeTheBall -> RE: Database using Access query - passing parameter (8/24/2003 18:23:09)

quote:

When I modify the "fp_sQry="SELECT * FROM qryPets" line to "fp_sQry="SELECT * FROM qryPets WHERE AreaID=3" then save... it goes back to the plain Select line. (I didn't notice that before...)


The code is re-writing itself because of the extra code that Frontpage puts in (the gray code). Find the same SQL in the gray code and make your change there instead of in the red. It should work.

You also may want to learn how to get rid of the gray code. It makes life a lot easier. Read about the Spooky Diet.




webcats -> RE: Database using Access query - passing parameter (8/24/2003 18:43:26)

Yeeeaaaahhh! It works! [:)]

I don't understand why though... I was actually modifying both the Gray and the Red code before, then tried just the Red. I guess I should have taken it all the way and just modified the Gray only. Oh well, as long as it works.

Thanks!




rdouglass -> RE: Database using Access query - passing parameter (8/25/2003 16:17:44)

quote:

Ahh, ok - you are using an Access query.
Its not something I have attempted to do via the DRW and believe its not possible


That's funny, I think I do that all the time.....call the Access query instead of the table itself.

If we're talking about the same thing, it definitely is possible...[8|]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125