![]() |
|
|
Published: Tuesday, November 17, 1998
Using Parameterized Queries ***************************************************************** * This article discusses how to use parameterized stored procedures using Acive Server Pages. In the last WebDaily emailing, I discussed several tips on how to optimize your ASP code for performance. One technique I mentioned was to use SQL stored procedures. Using stored procedures will not only make your code more maintainable (through yet another layer of abstraction between your data model and code), but will also increase performance, since SQL caches your stored procedure's execution plans when they are executed for the first time. In the last WebDaily emailing I also discussed how to explicitly call a stored procedure in ASP. The example I gave looked like this:
I mentioned that there was a Parameters collection in Active Server Pages to streamline this process. Over the weekend Muhammad Atif submitted the following tutorial on how to call stored procedures through ASP: (If you'd like to submit a tip (as it is greatly, GREATLY appreciated), please visit the Add a Tip page.)
You can call store procedures in ASP like this
and your result from store procedure is in
if you want it in resultset than
where 0 and 1 are fields of table (You can also use the associative names (the string representations for your recordset columns) that you're use to using.)
Thanks for the tip Mr. Atif!! If you have any questions or comments, or ideas about future WebDaily articles, please email me at mitchell@4guysfromrolla.com. Have a great day! Happy Programming!
*****************************************************************
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||