473,396 Members | 1,940 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,396 software developers and data experts.

EOF .NET equivalent?

When using classic ASP, I would use something like what's below to show HTML
if the recordset was empty.

<% If RS.EOF And RS.BOF Then %>
<p>There are no records to display.</p>
<% End If %>

Now...as I'm learning ASP.NET, I'll use something like what's below to loop
thru a recordset.

<%
While MyData.Read()
Response.Write...stuff.....
End While
%>

But as simple as it may seem, I cannot find any references in my books or
online how to "detect" if the recordset is empty. I'm basing my SELECT
statement off of a search form so if the user types something that's not
useful like "tuvwxyz", the query will most likely return nothing. Any
pointers?

Thanks

--

*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************

Nov 18 '05 #1
5 1714
Shane,

If there are no records While MyData.Read will never begin the loop.

It's just skipped over automatically because .Read never fires since there
are no records.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"D. Shane Fowlkes" <sh***@raccoonbob.com> wrote in message
news:OF****************@tk2msftngp13.phx.gbl...
When using classic ASP, I would use something like what's below to show HTML if the recordset was empty.

<% If RS.EOF And RS.BOF Then %>
<p>There are no records to display.</p>
<% End If %>

Now...as I'm learning ASP.NET, I'll use something like what's below to loop thru a recordset.

<%
While MyData.Read()
Response.Write...stuff.....
End While
%>

But as simple as it may seem, I cannot find any references in my books or
online how to "detect" if the recordset is empty. I'm basing my SELECT
statement off of a search form so if the user types something that's not
useful like "tuvwxyz", the query will most likely return nothing. Any
pointers?

Thanks

--

*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************

Nov 18 '05 #2
Yes, I know. That's my point. How would I display a message indicating
there are no records when there are no records? For example...

<% If Not RS.EOF Or Not RS.BOF Then %>
Go thru my loop and display records.......
<% Else %>
<p> Sorry, there are no matching your request at this time. </p>
<% End If%>

Thanks

--
*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
Shane,

If there are no records While MyData.Read will never begin the loop.

It's just skipped over automatically because .Read never fires since there
are no records.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"D. Shane Fowlkes" <sh***@raccoonbob.com> wrote in message
news:OF****************@tk2msftngp13.phx.gbl...
When using classic ASP, I would use something like what's below to show

HTML
if the recordset was empty.

<% If RS.EOF And RS.BOF Then %>
<p>There are no records to display.</p>
<% End If %>

Now...as I'm learning ASP.NET, I'll use something like what's below to

loop
thru a recordset.

<%
While MyData.Read()
Response.Write...stuff.....
End While
%>

But as simple as it may seem, I cannot find any references in my books or online how to "detect" if the recordset is empty. I'm basing my SELECT
statement off of a search form so if the user types something that's not
useful like "tuvwxyz", the query will most likely return nothing. Any
pointers?

Thanks

--

*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************


Nov 18 '05 #3
if objDR.Read() then
Do
...
Loop While objDR.Read()
Else
...
End If

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"D. Shane Fowlkes" <sh**********@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Yes, I know. That's my point. How would I display a message indicating
there are no records when there are no records? For example...

<% If Not RS.EOF Or Not RS.BOF Then %>
Go thru my loop and display records.......
<% Else %>
<p> Sorry, there are no matching your request at this time. </p>
<% End If%>

Thanks

--
*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
Shane,

If there are no records While MyData.Read will never begin the loop.

It's just skipped over automatically because .Read never fires since there
are no records.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"D. Shane Fowlkes" <sh***@raccoonbob.com> wrote in message
news:OF****************@tk2msftngp13.phx.gbl...
When using classic ASP, I would use something like what's below to show
HTML
if the recordset was empty.

<% If RS.EOF And RS.BOF Then %>
<p>There are no records to display.</p>
<% End If %>

Now...as I'm learning ASP.NET, I'll use something like what's below to

loop
thru a recordset.

<%
While MyData.Read()
Response.Write...stuff.....
End While
%>

But as simple as it may seem, I cannot find any references in my books

or online how to "detect" if the recordset is empty. I'm basing my

SELECT statement off of a search form so if the user types something that's not useful like "tuvwxyz", the query will most likely return nothing. Any
pointers?

Thanks

--

*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************



Nov 18 '05 #4
See answer farther down the thread!

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"D. Shane Fowlkes" <sh***@raccoonbob.com> wrote in message
news:OF****************@tk2msftngp13.phx.gbl...
When using classic ASP, I would use something like what's below to show HTML if the recordset was empty.

<% If RS.EOF And RS.BOF Then %>
<p>There are no records to display.</p>
<% End If %>

Now...as I'm learning ASP.NET, I'll use something like what's below to loop thru a recordset.

<%
While MyData.Read()
Response.Write...stuff.....
End While
%>

But as simple as it may seem, I cannot find any references in my books or
online how to "detect" if the recordset is empty. I'm basing my SELECT
statement off of a search form so if the user types something that's not
useful like "tuvwxyz", the query will most likely return nothing. Any
pointers?

Thanks

--

*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************

Nov 18 '05 #5
There are a couple of ways. Using your methodology, you can do the
following:

<%
Dim blnRecords As Boolean = false

While MyData.Read()
'Set boolean
blnRecords = true
Response.Write...stuff.....
End While

If blnRecords = False then
Response.Write("No records dood!")
End If
%>

In general, I would learn to write from codeBehind, rather than embed code.
While it was necessary in ASP, it is bad form, overall, in ASP.NET (changes
a bit in ASP.NET 2.0 - Whidbey, but that is another story).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"D. Shane Fowlkes" <sh**********@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Yes, I know. That's my point. How would I display a message indicating
there are no records when there are no records? For example...

<% If Not RS.EOF Or Not RS.BOF Then %>
Go thru my loop and display records.......
<% Else %>
<p> Sorry, there are no matching your request at this time. </p>
<% End If%>

Thanks

--
*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
Shane,

If there are no records While MyData.Read will never begin the loop.

It's just skipped over automatically because .Read never fires since there
are no records.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"D. Shane Fowlkes" <sh***@raccoonbob.com> wrote in message
news:OF****************@tk2msftngp13.phx.gbl...
When using classic ASP, I would use something like what's below to show
HTML
if the recordset was empty.

<% If RS.EOF And RS.BOF Then %>
<p>There are no records to display.</p>
<% End If %>

Now...as I'm learning ASP.NET, I'll use something like what's below to

loop
thru a recordset.

<%
While MyData.Read()
Response.Write...stuff.....
End While
%>

But as simple as it may seem, I cannot find any references in my books

or online how to "detect" if the recordset is empty. I'm basing my

SELECT statement off of a search form so if the user types something that's not useful like "tuvwxyz", the query will most likely return nothing. Any
pointers?

Thanks

--

*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************



Nov 18 '05 #6

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

Similar topics

14
by: John | last post by:
Is there an equivalent of COM on Linux that I can get through Python. My need is to have some sort of language independent component framework. I can think of CORBA but I have to have a server...
2
by: Michael Foord | last post by:
Please pardon my ignorance on this one - but I'm not certain how the sign bt is treated in python bitwise operators. I've trying to convert a javascript DES encryption routine into python. ...
3
by: Robert Dodier | last post by:
Hello, Here's a thought that I'm sure has already occurred to someone else, I just can't find any record of it yet. An XML document is just a more verbose and clumsy representation of an...
1
by: Vannela | last post by:
Is there any equivalent control in .NET for the Power builder DataWindow control? I am explaining the Datawindow architecture to some extent. Power Builder DataWindow Control has got different...
6
by: Frank Rachel | last post by:
So I can focus on the correct areas of research, I was wondering if someone could give me the .NET equivelents for this J2EE architecture: JSP's make calls to local JavaBean Controls. The...
3
by: Marty | last post by:
Hi, What is the VB.NET equivalent of the VB6 ADODB.Connector and ADODB.Recordset? Thanks Marty
7
by: Tim Conner | last post by:
Hi, I am an ex-delphi programmer, and I having a real hard time with the following simple code (example ): Which is the equivalent to the following code ? var chars : PChar; sBack, s :...
10
by: karch | last post by:
How would this C# contruct be represented in C++/CLI? Or is it even possible? PolicyLevel level = (enumerator->Current) as PolicyLevel; Thanks, Karch
9
by: Alan Silver | last post by:
Hello, I'm converting some old VB6 code to use with ASP.NET and have come unstuck with the Asc() function. This was used in the old VB6 code to convert a character to its ASCII numeric...
14
by: grid | last post by:
Hi, I have a certain situation where a particular piece of code works on a particular compiler but fails on another proprietary compiler.It seems to have been fixed but I just want to confirm if...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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...
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,...

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.