ADO Command and Stored Procedures

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.

You might also like...

Comments

David Nishimoto NishiSoft provides Part I of the Information Technology Project collaboration. Sign up and list your IT project tasks, assign task too friends, and get percent complete task. Part will include a wo...

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”