这个比较难找。
我给你一个实例吧。
首先创建一个表供测试:
--begin of sql script
create table a
(
id int not null primary key identity(1,1),
account varchar(20) not null,
pwd varchar(20) not null
)
go
--end of sql script
然后创建一个存储过程
create proc addAccount(@account varchar(20),@pwd varchar(20))
as
insert into a (account,pwd) values(@account,@pwd)
go
然后,在asp中:
<%
Dim objConn,objCmd,objRst
Set objConn=Server.CreateObject("ADODB.Connection")
Set objCmd=Server.CreateObject("ADODB.Command")
objCmd.CommandType=adCmdStoredProc
objCmd.CommandText="Your_Stored_Procedure_Name"
'If your procedure need parameters, then add them
objCmd.Parameters.Append objCmd.CreateParameter("@Parameter_Name",Your_Parameter_Data_Type,Your_Parameter_Type,Length,Value)
......
Set objRst=objCmd.Execute
'Now objRst Stores the record set that the procedure returned
'End of Example
---------------------------------------
Your_Parameter_Data_Type can be adInteger,adTinyint, adVarChar, etc.
Your_Parameter_Type can be adParamInput, adParamOutPut, adParamInputOutPut, adParamReturnValue, adParamUnKnown.
Length is the size of the parameter, for example, if the data type is adInteger, Length should be 4, else if adVarChar, Length should be the actual siz of this parameter.
The following is some examples of append parameters to the command object.