ADO Recordcount = -1
From: DS (dsweatman_at_bellsouth.net)
Date: 01/25/05
- Next message: Marc G: "Re: Fields not longer available when subclassing the _RecordsetPtr"
- Previous message: Stephen Howe: "Re: Finding Records"
- Next in thread: Marc G: "RE: ADO Recordcount = -1"
- Reply: Marc G: "RE: ADO Recordcount = -1"
- Reply: Stephen Howe: "Re: ADO Recordcount = -1"
- Messages sorted by: [ date ] [ thread ]
Date: 25 Jan 2005 10:05:04 -0800
The following code is in a asp page. I can't get the recordcount to
return the correct information. The recordset is populated because I
can loop through it. How do I get the recordcount to work correctly?
Any help would be greatly appreciated!
Dim madoRs,madoCmd,msConn,msSQL
Set madoRs = Server.CreateObject("ADODB.Recordset")
Set madoCmd = Server.CreateObject("ADODB.Command")
msConn = "Provider=SQLOLEDB;Data Source=XXXXXDEV;Initial
Catalog=TestDB;UID=xxx;PWD=xxx"
msSQL = "select lMSDSId from tblMSDS"
With madoRs
.MaxRecords = MAX_ROWS
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenStatic
End With
With madoCmd
.ActiveConnection = msConn
.CommandType = adCmdText
.CommandText = msSQL
.CommandTimeout = 60
Set madoRs = .Execute
Set .ActiveConnection = Nothing
End With
Set madoCmd = Nothing
'empty recordset
If err.number = 0 Then
If madoRs.RecordCount = 0 Then
msMsg = "There are no MSDSs matching your search criteria."
End If
End If
Thanks,
Deidre
- Next message: Marc G: "Re: Fields not longer available when subclassing the _RecordsetPtr"
- Previous message: Stephen Howe: "Re: Finding Records"
- Next in thread: Marc G: "RE: ADO Recordcount = -1"
- Reply: Marc G: "RE: ADO Recordcount = -1"
- Reply: Stephen Howe: "Re: ADO Recordcount = -1"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|