|
-
Apr 14th, 2007, 12:56 AM
#1
Thread Starter
New Member
Run-time error 40088, 40008
Hi
I am using RDO connection to get data from sybase 12.5. In VB 6.0 my code goes like this:
Code:
Dim cn As New rdoConnection
Dim rdoRS As rdoResultset
Dim rs, rs1 As rdoResultset
cn.Connect = "uid=R64037;pwd=***;server=TEST_SERVER;" _
& "driver={SYBASE ASE ODBC Driver};NA=test.com,4500;database=test_database;" _
& "DSN=test_dsn;"
cn.CursorDriver = rdUseOdbc
cn.EstablishConnection rdDriverNoPrompt
SQL = "exec JP_FIND_STRING " & "'" & Text1.Text & "'"
Set rdoRS = cn.OpenResultset(SQL)
While Not rdoRS.EOF
List1.AddItem (rdoRS.rdoColumns(0).Value)
rdoRS.MoveNext
Wend
While Executing the above code, I am getting the run-time error
40088 - No open Cursor or Cursor Closed (I am getting this always)
40008 - Invalid operation for forward only cursor (i am getting this occassionally)
Kindly suggest me the solution
Thanks in Advance
Regards,
J.Hari
Last edited by si_the_geek; Apr 14th, 2007 at 10:30 AM.
Reason: added code tags
-
Apr 14th, 2007, 10:33 AM
#2
Re: Run-time error 40088, 40008
I can't see anything obvious... the only thing that I think is likely to cause the issue is the (stored procedure?) JP_FIND_STRING not returning what you expect it to. To be able to tell why, we'll need more info about it.
Is there are particular reason for using RDO (which is officially obsolete) instead of the more modern & well supported ADO? The code is very similar, so switching should be fairly simple.
-
Apr 15th, 2007, 11:23 PM
#3
Re: Run-time error 40088, 40008
if you change it to cn.EstablishConnection rdDriverPrompt and select the driver manually, do you get any errors...
 Originally Posted by hari_vb
Dim rs, rs1 As rdoResultset
And you need to change the declaration as in VB you should specify the data type for each variable, so, it should be
vb Code:
Dim rs As rdoResultset, rs1 As rdoResultset
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Apr 19th, 2007, 04:18 PM
#4
New Member
Re: Run-time error 40088, 40008
I had something like this happen today. I suddenly started receiving the "No Open Cursor or Cursor Closed" when I tested .EOF after opening a recordset on a stored procedure I was working on.
In my case, the cause was, I had changed the stored procedure so that it sometimes returned no recordset. Not an EMPTY recordset...no recordset at all. You should re-visit your JP_FIND_STRING stored proc and carefully inspect it to see if there is any way it might exit without returning the results of a SELECT statement. One common way this could happen is if your stored proc has the ability to exit early with just a return code, maybe?
My stored proc, for example, generates a .CSV file, and I wanted to include a header row in the file...but I didn't want it to return just the header row if there were no result records, so at first I did this:
IF 1 < (SELECT COUNT(1) FROM @tResults)
SELECT CombinedLine
FROM @tResults
ORDER BY ResultID
This caused the error message to start appearing whenever there were no results, until I changed it to this:
SELECT CombinedLine
FROM @tResults
WHERE 1 < (SELECT COUNT(1) FROM @tResults)
ORDER BY ResultID
which returns an empty recordset, instead of a nonexistent one, if @tResults contains 1 row or less.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|