但是在2003系统下一切运行正常,
“如调用存储过程的代码怎么会是那样子的?”
另外我用换代码调用存储过程结果是一样的不行
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Set parm_date1 = New ADODB.Parameter
Set mycommand = New
' parm_jobid.Name = "name1"
parm_date1.Type = adChar '参数类型
parm_date1.Size = 10 '参数长度
parm_date1.Direction = adParamInput
'参数方向,输入或输出
parm_date1.Value = DTPicker1.Value '参数的值
mycommand.Parameters.Append parm_date1 '加入参数
Set parm_date2 = New ADODB.Parameter
'parm_joblvl.Name = "name2"
parm_date2.Type = adChar
parm_date2.Size = 10
parm_date2.Direction = adParamInput
parm_date2.Value = DTPicker2.Value
mycommand.Parameters.Append parm_date2
mycommand.ActiveConnection = cnn1
'指定该command 的当前活动连接
= "sp_kjy_tj"
'myprocedure 是你要调用的存储过程名称
= adCmdStoredProc
'表明command 为存储过程
Set rstByQuery = New ADODB.Recordset
Set rstByQuery = mycommand.Execute()
MSFlexGrid1.Rows = 1
'动态设置MSFlexGrid的行和列
MSFlexGrid1.Cols = rstByQuery.Fields.Count
MSFlexGrid1.Row = 0
For i = 0 To rstByQuery.Fields.Count - 1
MSFlexGrid1.Col = i
MSFlexGrid1.Text = (rstByQuery.Fields.Item(i).Name)
Next '设置第一行的标题,用域名填充
i = 1
Do While Not rstByQuery.EOF
MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
MSFlexGrid1.Row = i '确定行
For j = 0 To rstByQuery.Fields.Count - 1
MSFlexGrid1.Col = j
'添充所有的列
If IsNull(rstByQuery(j)) Then
MSFlexGrid1.Text = ""
Else
MSFlexGrid1.Text = rstByQuery(j)
End If
Next
rstByQuery.MoveNext
i = i + 1
Loop
End Sub