存储过程
CREATE PROCEDURE [dbo].[yspjdr]
-- Add the parameters for the stored procedure here
@datestart datetime ,
@dateend datetime
AS
insert into ysdj(billcode,maketime,unitcode,clientname,taxmoney)
select a.billcode,a.maketime,a.unitcode,b.clientname,a.taxmoney
from zbttfpf..BillConsignmentCredence a
join zbttfpf..ClientUnit b on a.ClientID=b.ClientID
where MakeTime>=@datestart and MakeTime<@dateend+1 and billcode not in (select billcode from ysdj)
在VB中怎么调用,请高手帮忙啊,代码应该怎么写
CREATE PROCEDURE [dbo].[yspjdr]
-- Add the parameters for the stored procedure here
@datestart datetime ,
@dateend datetime
AS
insert into ysdj(billcode,maketime,unitcode,clientname,taxmoney)
select a.billcode,a.maketime,a.unitcode,b.clientname,a.taxmoney
from zbttfpf..BillConsignmentCredence a
join zbttfpf..ClientUnit b on a.ClientID=b.ClientID
where MakeTime>=@datestart and MakeTime<@dateend+1 and billcode not in (select billcode from ysdj)
在VB中怎么调用,请高手帮忙啊,代码应该怎么写
打开conn后
就可以conn.execute "yspjdr '" 参数1 +"','"+参数2+"'"
@dateend的值,按command1执行存储过程,那应该怎么写,我是新手,请不要嫌我麻烦哈
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim param As ADODB.Parameter Set cn = New ADODB.Connection
'cn.CursorLocation = adUseClient
cn.Open "......" Set cmd = New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandText = "yspjdr"
cmd.CommandType = adCmdStoredProc
Set param = cmd.CreateParameter("@datestart", adDate, adParamInput, , dt1.value)
cmd.Parameters.Append param
Set param = cmd.CreateParameter("@dateend", adDate, adParamInput, , dt2.value)
cmd.Parameters.Append param Set rs = cmd.Execute
Set cmd = Nothing
Set rs = Nothing
Set cn = Nothing