我的程序可以跑但是没结果。
rs.Field.Count是有结果的
rs.RecordCount结果是-1(肯定不对)
rs.GetRow或者掉rs结果都是error type mismatch.
我感觉是没有调出东西来?procedure肯定是好的,直接在excel上用connection有结果的
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim Cmd As ADODB.Command
Dim strConn As String
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set Cmd = New ADODB.Command
strConn = "Provider=MSDASQL.1;Persist Security Info=True;DSN=pmw;Description
=PMW;UID=pmwreader;Trusted_Connection=Yes;APP=2007 Microsoft Office system;
WSID=BG-RXU;DATABASE=pmw"
cn.Open strConn
Cmd.ActiveConnection = cn
Cmd.CommandText = "Reports.HistoricalReturns"
Cmd.CommandType = adCmdStoredProc
Cmd.Parameters.Refresh
Cmd.Parameters(1).Value = "capf"
Cmd.Parameters(2).Value = Null
Cmd.Parameters(3).Value = "01/01/08"
Cmd.Parameters(4).Value = "10/31/11"
Set rs = Cmd.Execute()