Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: record count


Message #1 by philip.moh@a... on Mon, 31 Dec 2001 15:52:46 +0800
 cnn.Open cns, cnp1, cnp2
    cmd.ActiveConnection = cnn
    cmd.CommandText = SqlCmd
    Set rst = cmd.Execute
    rst.Close
    rst.CursorType = adOpenKeyset
    rst.Open

Try Closing the recordset , set cursortype to adOpenkeyset and reopen . Then
Recordcount will return total number of records. It works. 


Anita
> -----Original Message-----
> From:	philip.moh@a... [SMTP:philip.moh@a...]
> Sent:	Monday 31 December 2001 13:23
> To:	professional vb
> Subject:	[pro_vb] record count
> 
> Hi,
> 
> Does anyone know how to get the total record?
> 
> I do the following but got -1 as total record:
> ----------
> myConn.Open "DSN=poinfo"
> mySql1 = "Select * from newPO"
> 
> myRec1.Open mySql1, myConn, adOpenDynamic, adLockOptimistic
> myRec1.MoveLast
> cNum = myRec1.RecordCount
> 
> MsgBox cNum
> myRec1.MoveFirst
> cKey = myRec1!Field1
> ----------
> 
> when I do the message box, I got -1 as the total record...why???
> 
> Thanks in advance.
> 
> 
> 
> 
> 

  Return to Index