我的sp如下:
create proc [sp_fz_deta]
@ym varchar(8), --年月yyyy/mm
@empl_id varchar(4),--員工編號
@max_day int--當月的天數
as
declare @bdate varchar(10)
declare @i int
declare @no int
declare @temp table ([year] varchar(2) ,[no] int)
set @i=1
set @no=0
while @i<=@max_day
begin
set @bdate=@ym+'/'+right('0000'+cast(@i as varchar(2)),2)
select @no=@no+count(*) from t_brdl_fz_sour where flag='1' and empl_id=@empl_id and work_date=@bdate
select @no=@no+count(*) from t_bmad_fz_sour where flag='1' and empl_id=@empl_id and work_date=@bdate
select @no=@no+count(*) from t_mob_fz_sour where flag='1' and empl_id=@empl_id and work_date=@bdate
insert into @temp values(@i,@no)
set @i=@i+1
set @no=0
end
select * from @temp
如何在vb裡面得到 select * from @temp 的返回值???
我是這樣寫的
Set iRecordset = Conn.Execute("exec sp_fz_deta '" & TxtDate.Text & "','" & TxtNo.Text & "','" & day & "'")
不行?
create proc [sp_fz_deta]
@ym varchar(8), --年月yyyy/mm
@empl_id varchar(4),--員工編號
@max_day int--當月的天數
as
declare @bdate varchar(10)
declare @i int
declare @no int
declare @temp table ([year] varchar(2) ,[no] int)
set @i=1
set @no=0
while @i<=@max_day
begin
set @bdate=@ym+'/'+right('0000'+cast(@i as varchar(2)),2)
select @no=@no+count(*) from t_brdl_fz_sour where flag='1' and empl_id=@empl_id and work_date=@bdate
select @no=@no+count(*) from t_bmad_fz_sour where flag='1' and empl_id=@empl_id and work_date=@bdate
select @no=@no+count(*) from t_mob_fz_sour where flag='1' and empl_id=@empl_id and work_date=@bdate
insert into @temp values(@i,@no)
set @i=@i+1
set @no=0
end
select * from @temp
如何在vb裡面得到 select * from @temp 的返回值???
我是這樣寫的
Set iRecordset = Conn.Execute("exec sp_fz_deta '" & TxtDate.Text & "','" & TxtNo.Text & "','" & day & "'")
不行?
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include virtual="/ASPSAMP/SAMPLES/ADOVBS.INC"-->
<HTML>
<HEAD><TITLE>Place Document Title Here</TITLE></HEAD>
<BODY>
This first method queries the data source about the parameters
of the stored procedure. This is the least efficient method of calling
a stored procedure.<BR>
<%
Set cn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cn.Open "data source name", "userid", "password"
Set cmd.ActiveConnection = cn
cmd.CommandText = "sp_test"
cmd.CommandType = adCmdStoredProc
' Ask the server about the parameters for the stored proc
cmd.Parameters.Refresh
' Assign a value to the 2nd parameter.
' Index of 0 represents first parameter.
cmd.Parameters(1) = 11
cmd.Execute
%>
Calling via method 1<BR>
ReturnValue = <% Response.Write cmd.Parameters(0) %><P>