先生,我正在使用 vb6.0 和 sql server 2005。我写了一个小程序,它在 sql server 中立即返回结果,但在 vb 6.0 中它返回超时。对任何身体有任何想法吗?请帮忙?
我的程序:
Alter procedure
[dbo].[SpRptSalesDayBookSummary](@liComid integer,@liPerid integer,@ad_dtfrm DateTime,@ad_dtto DateTime)
AS
begin
SET NOCOUNT ON;
Select SaleDate,Sum(Grand) as tot
from SalesMaster a,SalesDet b
Where a.id=b.RefId
And a.CompanyId= @liComid
And a.PeriodId=@liPerid
And a.SaleDate Between @ad_dtfrm And @ad_dtto
Group By SaleDate Order By SaleDate
End
我的VB代码:
Dim cmd As New ADODB.Command
Dim rs1 As New ADODB.Recordset
Dim param2 As ADODB.Parameter
Dim param3 As ADODB.Parameter
Dim param4 As ADODB.Parameter
Dim param5 As ADODB.Parameter
g_objData.DBConn.CursorLocation = adUseClient
Set cmd.ActiveConnection = g_objData.DBConn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "SpRptSalesDayBookSummary"
Set param2 = cmd.CreateParameter("Input", adInteger, adParamInput)
cmd.Parameters.Append param2
param2.value = 20
Set param3 = cmd.CreateParameter("Input", adInteger, adParamInput)
cmd.Parameters.Append param3
param3.value = 8
Set param4 = cmd.CreateParameter("Input", adDate, adParamInput)
cmd.Parameters.Append param4
param4.value = Format(PD_DtFrm, "yyyy-mm-dd")
Set param5 = cmd.CreateParameter("Input", adDate, adParamInput)
cmd.Parameters.Append param5
param5.value = Format(PD_DtTo, "yyyy-mm-dd")
Set rs1 = cmd.Execute
请帮忙。