Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset.MoveNext returs records twice

Status
Not open for further replies.

aarellano

MIS
Oct 22, 2007
168
US
Hello,

I have an asp script that returns different record. The problem that I am having is that the script returns the same record twice.

here is what my code looks like
Code:
'Dimension variables
Dim adoCon          'Holds the Database Connection Object
Dim rsGuestbook         'Holds the recordset for the record to be updated
Dim strSQL  
dim totalValue      'Holds the SQL query for the database
'Dim lngRecordNo            'Holds the record number to be updated
'Read in the record number to be updated
'lngRecordNo =CLng(Request.QueryString("ID"))

'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("na.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM gm, weeks order by  total DESC"


<body>
<% 

If Not rsGuestBook.EOF Then 
  Do while not rsGuestBook.EOF 

fields
.
.
%>

</body>

<%

     
    
      'Increment the count by 1 to get the next number
     
      rsGuestBook.MoveNext
  Loop
End If


'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
 
you created rsGuestbook as a recordset but never opened it, at least by the code supplied

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never in the 'loop' " - DreX 2005
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top