VB6 调用存储过程问题
本人想验证一下VB6调用存储过程,建立存储过程如下:
CREATE PROCEDURE [dbo].[sp_tb_item] AS
select * from tb_item
GO
VB6调用存储过程代码如下:
On Error GoTo Emsg
Dim Con As New ADODB.Connection
Dim Cmd As New ADODB.Command
Dim Res As New ADODB.Recordset
Con.Open StrConn
With Cmd
.ActiveConnection = Con
.CommandText = "sp_tb_item"
.CommandType = adCmdStoredProc
End With
Set Res = Cmd.Execute
If Not Res.EOF Then
Set MSH.DataSource = Res
End If
Con.Close
Set Con = Nothing
Set Res = Nothing
Set Cmd = Nothing
Exit Sub
Emsg:
MsgBox Err.Description, vbInformation, "系统提示"
Con.Close
Set Con = Nothing
Set Res = Nothing
Set Cmd = Nothing
但是调试错误提示如下:
不能访问数据。数据源设置可能不正确或者数据源的功能有限。
百思不得其解。