.recordcount spoof ?

Results 1 to 4 of 4

Thread: .recordcount spoof ?

  1. #1
    the rock Guest

    Default .recordcount spoof ?

    Hi, I am using 2 connection strings in my DLL for my current project. The first conn string uses MSAccess while the 2nd uses SQLSVR7. No problem with the first connection; however by using the 2nd one, retrieving the .recordcount gives -1 ! <BR><BR>1st conn string to Access(Ok):<BR> objConn.Open ("Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source= " & App.Path & "library.mdb")<BR><BR>2nd conn string to SQLSVR7(gives -1!):<BR> objConn.Open ("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;" & _<BR> "Initial Catalog=university;Data Source=svi-rnd-001")<BR><BR>Both uses this RecordSet.Open method:<BR> objRs.Open strSQL, objConn, adOpenKeyset, adLockOptimistic<BR> x = objRs.RecordCount (this gives -1??!!)<BR><BR>Any Reason for this ?<BR><BR>I appreciate any help.<BR><BR>Thanks !<BR><BR><BR>

  2. #2
    peterjl@austec.net.au Guest

    Default RE: .recordcount spoof ?

    Try Cursortype = adOpenDynamic<BR><BR>objRs.Open strSQL, objConn, adOpenDynamic, adLockOptimistic<BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: .recordcount spoof ?

    Switch it to what the other respondent wrote. In case you are wondering why this happened, if do not open the rs in the specified way, the rs.recordcount is not supported. Weird, I know.

  4. #4
    Charles Sirait Guest

    Default RE: .recordcount spoof ?

    I think the problem is that you&#039re using adUseServer CursorLocation property. Try this one<BR><BR>--------------------------<BR>objRs.Open strSQL, objConn, adOpenDynamic, adLockOptimistic<BR>If Not objRs.EOF Then<BR> objRs.MoveLast<BR> nTotRec = objRs.RecordCount<BR>End If<BR>--------------------------<BR><BR>Then you&#039ll get the value of nTotRec. Happy Programming...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts