我的数据库难题!
我在VB中调用SQL Server 2000中的存储过程,代码如下:Dim cn2 As New ADODB.Connection
Dim cmd2 As New ADODB.Command
Dim parm_2 As New ADODB.Parameter
Dim rs2 As New ADODB.Recordset
cn2.Open "driver={SQL Server};server=(local);database=DBGoodsOrder"
cmd2.ActiveConnection = cn2
cmd2.CommandText = "LatestCustID"
cmd2.CommandType = adCmdStoredProc
Set parm_2 = cmd2.CreateParameter("regname", adChar, adParamInput, 8, DateStr)
cmd2.Parameters.Append parm_2
Set rs2 = cmd2.Execute()
If rs2.BOF And rs2.EOF Then '若返回空记录集,表明数据库中没有要查找的记录
...
Else
...
End If
不知道为什么?老是在:“If rs2.BOF And rs2.EOF Then ”这里有问题,说是:“对象关闭,不允许执行操作”请高手指点迷津,小弟感激万分!!!