No Record count

Results 1 to 2 of 2

Thread: No Record count

  1. #1
    jvbnz Guest

    Default No Record count

    I am learning ASP. The following code tells me there are -1 records in the recordset, although there are 2.<BR>Similar code run from within Access gives the correct result.<BR><BR>Thanks for any help<BR><BR>Jim.<BR><BR>(Code begins)<BR><BR>Dim objConn, objRS<BR>Dim strConn<BR>Dim strCN, strPh, lngShipperID<BR>Dim strOut<BR><BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>strConn = "Data Source=JBCAsp;User ID=sa;PWD=;"<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR>objConn. Open strConn<BR><BR>objRS.CursorLocation = adUseClient &#039; adUseClient &#039;adUseServer <BR>objRS.CursorType = adOpenKeyset<BR>objRS.LockType = adLockOptimistic<BR><BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR><BR>objR S.Open "Visitors", objConn, , ,adCmdTable<BR>Response.Write "Number of records: " & objRS.RecordCount & "<BR>"<BR><BR>&#039;(cleanup)<BR>

  2. #2
    jvbnz Guest

    Default RE: No Record count

    I have found the error and corrected it by changing the order of commands to:<BR><BR>Set objRS = Server.CreateObject("ADODB.Recordset") <BR><BR>objRS.CursorLocation = adUseClient &#039; adUseClient &#039;adUseServer <BR>objRS.CursorType = adOpenKeyset <BR>objRS.LockType = adLockOptimistic <BR><BR><BR>

Posting Permissions

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