473,667 Members | 2,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sq lClient.SqlData Reader'

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

"L. Oborne" <none(at)none.a b> wrote in message
news:e%******** ********@TK2MSF TNGP10.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.Sq lClient.SqlData Reader'

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.Exec uteReader(Comma ndBehavior.Defa ult)

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.publi c.dotnet.framew ork.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.Sq lClient.SqlData Reader'

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.Sq lClient.SqlData Reader'

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_SP AM_4_MEyahoo.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.Sq lClient.SqlData Reader'

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_SP AM_4_MEyahoo.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.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.SqlD ataReader'

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
2094
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
1463
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 there (which int complete, but thats another post/story) which sorts the data A-Z or Z-A. The problem i am having is that the loop row (which isnt visible on the ASP page, as its ASP) is being sorted as well.
6
2856
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 loop through all the forms in a database and pull information about the form (controls and properties). We would need to do the same in our VB.NET project; loop through the project and get the web form's control and property information...
8
1666
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 a problem with a conditional in my loop not working correctly, I am sure that I have been overlooking something, but cannot pin it down. I have pared the code down quite a bit just so that I could resolve my issues with it. I have a page...
5
4226
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 from collection base, but use an internal collection, to hold the objects and then implement IEnumerator, see example below,
7
3245
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' cannot be created. Apartment threaded components can only be created on pages with an <%@ Page aspcompat=true %> page directive. Can anyone tell me what I'm doing wrong? Below is my code. <%@ Import Namespace="System.Data" %> <%@ Import...
2
1861
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 duplicate so many time, also i'm using a removeloop if the client want to remove the frame, in the html of the page i'm creating a table and i'm calling this loop, the problem now is that when i'm calling the removeloop it removes the frame but not the...
3
2693
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 DataRec.EOF SKU = trim (DataRec("SKU")) ITEM_ID = trim(DataRec("ITEM_ID")) ...
1
1462
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," rather than through a loop): '----------------------------------------------------------- if strOut1 <"" then If strOut1 = "N/A" then strOut1 = "&nbsp; " else
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8788
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8646
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.