Library code snippets
ADO Command and Stored Procedures
- Introduction
- Connection members
- Refreshing Parameters
Refreshing Parameters
The query string must first be examined before you can determine the number of parameters and their individual data types.
<% cm.Parameters.Refresh%>
Save yourself time by declaring the parameter objects manually instead of calling the refresh method. (Using Prepared Commands)
- Before queries are actually executed by the data provider on the database server, they are examined, optimized, and compiled into a pseudo-code that's later used to drive the data-retrieval system.
- To Prepare a Command Object, set the Prepared property to true.
Example
set cm.CommandText = "Update school set school_name = ? where id
= ?"
cm.CommandType = adCmdText
cm.Prepared =true
cm.Parameters.append cm.CreateParameter("name",adChar,adParamInput,50)
cm.Parameters.append cm.CreateParameter("school_id, adInteger, adParamInput)
cm("name")="Golden Lion"
cm("id") = 1
cm.execute
cm("name")="kenpo"
cm("id")=2
cm.execute
Stored Procedures
To call a stored procedure, the Parameter collection must be set to precisely
match the number and type of parameters defined on the server.
Related articles
Related discussion
-
Read eMails from Outlook express using ASP
by kumaravelu (1 replies)
-
Help to Call ASP function from onclick event in HTML to pass an array
by vka (0 replies)
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
Variable In Vb.Net
by chia (0 replies)
-
ideas in building a captive portal
by sjranjan (2 replies)
Related podcasts
-
Scott Guthrie
Scott catches up with Scott Guthrie in an interview covering Ajax, Asp 2.0, extender controls, CSS adapters and more.
HI I was wondering if anyone knows how to run a stored procedure prefrable from a .sql file against a new database in VB?
I would be very gratful for you help.
Chris
How do you easy add or update a recordset when you have opened it using a stored procedure?
I'm making a program where the user sees a recordset as a grid (used SP). The user can edit rows or add new ones by going into detail mode. (I use a tabstrip where Grid is on the first and a detail frame is on the second tab.) When user goes into editmode I want the user to manipulate the record and be able to update or add.
But it seems that SP only return readonly recordsets. Is that so?
How do one then implement the grid/detail scenario when using stored procedures?
Examples are preferred!!
regards
Svein Are Gronsund, Norway
This thread is for discussions of ADO Command and Stored Procedures.