在我的asp经典代码中,我想调用存储过程。但是,如果我尝试,我会
Operation is not allowed when the object is closed.
ASP代码:
dim soc
dim sql
dim dbConn
dim adRsTKIDEmpNum
set soc = Request.QueryString("id_list")
set dbConn = Server.CreateObject("ADODB.Connection")
set adRsTKIDEmpNum = Server.CreateObject("ADODB.Recordset")
dbConn.Open Application("System_ConnectionString")
sql = "sp_getEmployeeDetail '2411, 3468'"
adRsTKIDEmpNum.Open sql, dbConn, 1
do while not adRsTKIDEmpNum.EOF
loop
Response.write sql
当我致电do while not adRsTKIDEmpNum.EOF
时,我收到错误。
存储过程
Alter Procedure dbo.sp_getEmployeeDetail
@IDList varchar (max)
As
Declare @EmployeeDetail table(ID int,Employee_Number int)
insert into @EmployeeDetail(ID, Employee_Number)
select A.Item, B.employee_number from people.dbo.udf_Split(@IDList, ',') A
left join people.dbo.employee B on A.Item=B.ID
select * from @EmployeeDetail
GO
有谁知道什么是错的?
由于
答案 0 :(得分:0)
Alter Procedure dbo.sp_getEmployeeDetail
@IDList varchar (max)
As
SET NOCOUNT ON
Declare @EmployeeDetail table(ID int,Employee_Number int)
insert into @EmployeeDetail(ID, Employee_Number)
select A.Item, B.employee_number from people.dbo.udf_Split(@IDList, ',') A
left join people.dbo.employee B on A.Item=B.ID
select * from @EmployeeDetail
GO