Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordSet .open error

Status
Not open for further replies.

Azita79

Programmer
Jan 30, 2003
41
US
Hi All,

I am using VB 6 and SQL server 2000. I have a sproc with a DateTime IN Parameter. I am using a Recordset, pass the parameter to sproc and execute it. Here is the Error I get when I execute the .open line:
" The object you entered is not a valid Recordset property"

However when I copy the sql statement in the VB code and run it in the query Analyzer, it runs fine.


Any help would be greeeeeaaaatly appreciated.

Azita
 
Hi rubin,

Set rst = New ADODB.Recordset
With rst
Set .ActiveConnection = m_cnOnsite
.Source = strSQL
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.Open Options:=adCmdText
End With

and strSQL is something like "Exec sproc_Search '1/1/1992' "

and sproc_search:

create sproc_search(@beginDate DateTime) AS ....

Any thoughts anyone???
 
rubin,

I removed the Exec, but still getting the same error!
 
Does sproc_search(@beginDate DateTime) return a recordset?
Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Try this:


Set rst = New ADODB.Recordset
With rst
.ActiveConnection = m_cnOnsite
.Source = strSQL
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.Open , , , , adCmdText
End With

In addition take a look at ADODB.Command

And if all else fails try using the ADODC
 
Thanks guys,

The error was in my Stored Procedure

I had to SET NOCOUNT ON

Azita
[bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top