Dim datefrom As Date
Dim dateto As Date
datefrom = CDate(Text1.Text)
dateto = CDate(Text2.Text)Dim sql1 As String
cn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=cbxx;Data Source=ZSM2"
Adodc1.ConnectionString = cn
Adodc1.CommandType = adCmdStoredProc
Adodc1.RecordSource = "exec proc_tongjijf '" & datefrom & "','" & dateto & "'"
Adodc1.Refresh
End Sub
Dim dateto As Date
datefrom = CDate(Text1.Text)
dateto = CDate(Text2.Text)Dim sql1 As String
cn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=cbxx;Data Source=ZSM2"
Adodc1.ConnectionString = cn
Adodc1.CommandType = adCmdStoredProc
Adodc1.RecordSource = "exec proc_tongjijf '" & datefrom & "','" & dateto & "'"
Adodc1.Refresh
End Sub
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
cmd来执行你的存储过程?
..............
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "存储过程名"
cmd.Parameters.Append cmd.CreateParameter("@参数1", adChar, adParamInput, 20, "参数值")
set rs = cmd.Execute............
接下来就可以用rs来取得记录了。