Various code examples of calling a stored procedure from an ASP Page.

Contributed by
Rating: 2 stars2 stars2 stars2 stars2 stars / 8
April 15, 2000
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

This is the format for a stored proc where you want to pass parameters. This is a basic reference article the different ways you can create a stored Procedure, then pass it parameters to it.


'Name Your procedure and declare any variables using the @ symbol.
'Create this in the SQL database stored procedures section prior to running your ASP.

CREATE proc {procname}
@Var1 type
{@Var2 type}

As

{SQL Statement}

i.e. Select tblMe.FieldName From tblMe Where tblMeKey = @Variable1

To call Stored Procedure from ASP page you'd do

'Connection Execute Method String

set connection = server.createobject("adodb.connection")
connection.open someDSN
Connection.Execute "procname varvalue1, varvalue2"

'Close all objects and set to nothing
connection.close
set connection = nothing

**********************************
'Using Recordset Method
set connection = server.createobject("adodb.connection")
connection.open someDSN
set rs = server.createobject("adodb.recordset")
rs.Open "Exec procname varvalue1, varvalue2",connection

'Close all objects and set to nothing
rs.close
connection.close
set rs = nothing
set connection = nothing


 

blog comments powered by Disqus
DATABASE CODE ARTICLES

- Deployment of the MobiLink Synchronization M...
- MobiLink Synchronization Wizard in SQL Anywh...
- Finding Matching Records in Data Access Pages
- Using the AccessDataSource Control in VS 2005
- A Closer Look at ADO.NET: The Command Object
- A Closer Look at ADO.NET: The Connection Obj...
- Using ADO to Communicate with the Database, ...
- Code Snippets: Counting Records
- Constraints In Microsoft SQL Server 2000
- Multilingual entries into a DB and to be dis...
- Two combos, one textbox example
- ADO Recordset Paging
- SQL Server Database Creator - .NET Version
- Getting A List of Tables From SQL Server
- Discussion & Listserv Module by Mike Eck...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials