ADO和存储过程调用

时间:2018-06-26 12:56:52

标签: excel vba adodb

我正在使用下面的代码,但记录集未打开,我在做什么错了?

Dim rs As New ADODB.RecordSet
Dim Conn As New ADODB.Connection
Dim cmd As New ADODB.Command

Sql = "[dbo].[lc_PM11132_JCCostCashFlow_Report] ?"
With cmd
.ActiveConnection = Conn
.CommandText = Sql
.Parameters.Append .CreateParameter("@ReportType", adInteger, adParamInput)
.Parameters("@ReportType") = 1
End With
rs.Open cmd
rs.MoveFirst

0 个答案:

没有答案