VISUAL BASIC AND ORCLE

HI

I have a question about vb and oracle,
i have a recordset and i have a rows in
that recordset whenever i am trying
to get recordset.count i am getting
recordset.count value equals to -1.
how can i solve this please help
me in this

Thanks
abhi
abhisAsked:
Who is Participating?
 
bobbit31Connect With a Mentor Commented:
try this instead:

Dim strconn
   Dim objrs As New ADODB.Recordset
   Dim objconn As New ADODB.Connection
   strconn = "DSN=name;UID=userid;PWD=password"
   strsql = "SELECT SEQNO2 FROM ER2_EMPLOYER"
   objconn.CursorLocation = adUseClient
   objconn.Open strconn
   Set objrs = objconn.Execute(strsql)
   objrs.Open strsql, strconn, adOpenDynamic
   Set objrs = objconn.Execute(strsql)
   MsgBox (objrs.RecordCount)
   objrs.Close
   Set objrs = Nothing
0
 
RichardACommented:
Can you post a  sample of your call to set your record set object?  What parameters are you using when you create the recordset? There are some types of recordsets that you cannot retrieve the record count such as some forward scrolling cursors.
0
 
bobbit31Commented:
try opening the recordset with
cursor location = adUseClient (3) and
cursor type = adOpenDynamic (2)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rpaiCommented:
The RecordCount property would return -1 when ADO cannot determine the number of records or if the provider or cursor type does not support RecordCount. For a FORWARD-ONLY cursor, the RecordCount property will return -1. For a DYNAMIC cursor, either -1 or the actual count for a dynamic cursor, depending on the data source

The actual count would be returned only for a KEYSET/STATIC cursor type of recordsets.

Hope this helps.
0
 
abhisAuthor Commented:
Hi richard this is the code
Dim strconn
    Dim objrs As New ADODB.Recordset
    Dim objconn As New ADODB.Connection
    strconn = "DSN=name;UID=userid;PWD=password"
    strsql = "SELECT SEQNO2 FROM ER2_EMPLOYER"
    objconn.Open strconn
    Set objrs = objconn.Execute(strsql)
    'objrs.Open strsql, strconn, adOpenStatic
    'objrs.Open strsql, strconn, adOpenKeyset
    'Set objrs = objconn.Execute(strsql)
    MsgBox (objrs.RecordCount)
    objrs.Close
    Set objrs = Nothing
0
 
mdouganCommented:
RecordCount is not reliable in ADO, particularly for getting the number of records right after opening the recordset.

Try moving to the end of the recordset (objrs.MoveLast) and then look at the objrs.AbsolutePosition property.
0
 
bobbit31Commented:
notice the objconn.CursorLocation = adUseClient
0
 
abhisAuthor Commented:
hi

I Solve this problem,the problem was
i am using odbc for oracle,if i use microsoft odbc for
oracle i am getting exact record count.i tried
objconn.cursorlocation in odbc for oracle the record
count is showing -1 Only.thanks for your help.

Thanks
abhi
0
 
MoondancerCommented:
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY ABOUT THIS AND ALL YOUR OPEN QUESTIONS AT THIS SITE.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20100575.html
http://www.experts-exchange.com/questions/Q.20116946.html
http://www.experts-exchange.com/questions/Q.20121705.html
http://www.experts-exchange.com/questions/Q.20128637.html
http://www.experts-exchange.com/questions/Q.20172197.html
http://www.experts-exchange.com/questions/Q.20175814.html
http://www.experts-exchange.com/questions/Q.20182559.html
http://www.experts-exchange.com/questions/Q.20219898.html
http://www.experts-exchange.com/questions/Q.20243643.html
http://www.experts-exchange.com/questions/Q.20273999.html
http://www.experts-exchange.com/questions/Q.20274917.html
http://www.experts-exchange.com/questions/Q.20276523.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20003690.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
NetminderCommented:
Force-accepted by
Netminder
CS Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.