473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Do While Loop (ASP.NET) not working

I have this code working fine in Classic ASP but I get compile errors when I
try to run it as ASP.NET.

Do While NOT RS.EOF
If ...
Then...
Else...
End If
RS.MoveNext
Loop

It says that 'MoveNext' is not a member of
'System.Data.SqlClient.SqlDataReader'

Any suggestions?
Nov 18 '05 #1
5 9724
Yes - look up the documentation for the SqlDataReader class.

"L. Oborne" <none(at)none.ab> wrote in message
news:e%****************@TK2MSFTNGP10.phx.gbl...
I have this code working fine in Classic ASP but I get compile errors when I try to run it as ASP.NET.

Do While NOT RS.EOF
If ...
Then...
Else...
End If
RS.MoveNext
Loop

It says that 'MoveNext' is not a member of
'System.Data.SqlClient.SqlDataReader'

Any suggestions?

Nov 18 '05 #2
That is correct. You are thinking in old ASP ways, not ADO.NET

The correct way to do it would be:
(Forgive my VB.NET, wayyyy rusty!)

<pseudo-code>
Dim reader As SqlDataReader =
SqlCommand.ExecuteReader(CommandBehavior.Default)

Do While reader.Read()
If...
Then...
Else...
End If...
Loop
reader.Close()

HTH,

Kyril
-----Original Message-----
From: L. Oborne [mailto:none(at)none.ab]
Posted At: Wednesday, July 14, 2004 10:17 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Do While Loop (ASP.NET) not working
Subject: Do While Loop (ASP.NET) not working

I have this code working fine in Classic ASP but I get compile errors
when I
try to run it as ASP.NET.

Do While NOT RS.EOF
If ...
Then...
Else...
End If
RS.MoveNext
Loop

It says that 'MoveNext' is not a member of
'System.Data.SqlClient.SqlDataReader'

Any suggestions?
Nov 18 '05 #3
L. Oborne wrote:
I have this code working fine in Classic ASP but I get compile errors when I
try to run it as ASP.NET.

Do While NOT RS.EOF
If ...
Then...
Else...
End If
RS.MoveNext
Loop

It says that 'MoveNext' is not a member of
'System.Data.SqlClient.SqlDataReader'

Any suggestions?

Use .NextResult instead

http://msdn.microsoft.com/library/de...mberstopic.asp

note these are new 'structures' in ADO.NET (which replaced ADO); the
reader is basically like the old connected recordset, but there are
changes....

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #4
Great, Thanks!

Also, is there a replacement for 'If Not RS.EOF Then' ?
..NET does not like 'EOF'
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
L. Oborne wrote:
I have this code working fine in Classic ASP but I get compile errors when I try to run it as ASP.NET.

Do While NOT RS.EOF
If ...
Then...
Else...
End If
RS.MoveNext
Loop

It says that 'MoveNext' is not a member of
'System.Data.SqlClient.SqlDataReader'

Any suggestions?

Use .NextResult instead

http://msdn.microsoft.com/library/de...mberstopic.asp
note these are new 'structures' in ADO.NET (which replaced ADO); the
reader is basically like the old connected recordset, but there are
changes....

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #5
L. Oborne wrote:
Great, Thanks!

Also, is there a replacement for 'If Not RS.EOF Then' ?
.NET does not like 'EOF'
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
L. Oborne wrote:

I have this code working fine in Classic ASP but I get compile errors
when I
try to run it as ASP.NET.

Do While NOT RS.EOF
If ...
Then...
Else...
End If
RS.MoveNext
Loop

It says that 'MoveNext' is not a member of
'System.Data.SqlClient.SqlDataReader'

Any suggestions?


Use .NextResult instead


http://msdn.microsoft.com/library/de...mberstopic.asp
note these are new 'structures' in ADO.NET (which replaced ADO); the
reader is basically like the old connected recordset, but there are
changes....

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


Actually, I think you want the .Read() method that returns a boolean, I
gave you a different method:

http://msdn.microsoft.com/library/de...sreadtopic.asp

please see the documentation.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: AndrewM | last post by:
Hello, I have a SUB which has input variables. If I run it once its okay, but I need to include it in a for....next loop. Can this be done ? for i=0 to 100 call mySub(arr(0,i)) next
5
by: Fawke101 | last post by:
Hi There, I have a table with 3 rows. 1st has the table/column headers, 2nd contains the column data and the 3rd is where the loop for the SQL statement lies. I also have a JS sort function on...
6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
8
by: Drew | last post by:
I am building an application for keeping track of user permissions here at work. I have built the interfaces, and am now working on the processing page for inserting to the database. I am having...
5
by: Simon | last post by:
Hi all, I am writing a windows application using vb.net on the 1.1 framework. We have in the application, some strongly typed collections that have been written as classes that do not inherit...
7
by: Jerry | last post by:
I'm trying to execute a stored procedure in a loop while paging through database table records but the stored procedure isn't running. I get the folowing error: The component 'adodb.connection'...
2
by: mrjoka | last post by:
hi experts, i'm developing a page in ASP but i'm doing also some javascript insode the page. i'm creating a frame and i want to loop this frame with a duplicateloop function so the form will be...
3
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Here is my loop and it runs fine: ---------------------------------------------------- sSQL = "SELECT * FROM STORE_ITEMS" Set DataRec = DB.execute(sSQL) if not DataRec.EOF then do while not...
1
by: ll | last post by:
I'm working in ASP, and I'm trying to refine a site I inherited. In particular, there was code that looked like this (it checked for 15 different variables, doing it one at a time, "hardcoded,"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.