Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 73,569 times

Contents

Related Categories

ADO Command and Stored Procedures - Introduction

davepamn

Introduction

You can design stored procedures to hide such complexities, leaving a more concise interface available for application development.

The command object has the power to change the query each time it is used. The code below demonstrates how to use the ADO command object with these stored procedure. First, create the command object and connect the connection object to the command object.

'create a command object
set cm = Server.CreateObject("ADODB.Command")
'connect the command
cm.ActiveConnection = cn

Next, specify the query.

Method 1

set cm.CommandText = "Select * from schools"

Method 2 (Table)

set cm.CommandText = "schools"
cm.CommandType = adCmdTable


Method 3 (Stored Procedure)

set cm.CommandText = "add_school"
cmdCommandType = adCmdStoredProc

Method 4 (Stored Procedure with Parameters)

set cm.CommandText = "add_school"
cm.cmdCommandType = adCmdStoredProc

set p = cm.Parameters

p.Append cm.CreateParameter("@style",adChar,adParamInput,50)
p.Append cm.CreateParameter("@school", adChar, adParamInput,50)
p.Append cm.CreateParameter("@id",adInteger,adParamInput)

cm("@style") = "Kempo"
cm("@school") = "WSU"
cm(Id) = 1

cm.execute

Method 5 ( Return the results to a recordset)

rs.Open cm, cn

Method 6 ( Recordset, type, and locking method)

rs.Open cm, cn, adOpenKeyset, adLockOptimistic

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 work order system with NishiSoft acting as the middle man between software task order, verification of requirements meet and services delivered, and generation of the voucher for payment between parties.

Comments