473,473 Members | 4,257 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using GetRows()

I am getting information out of a table to place into to
an Array.
rs=DataConn.Execute(strSQL)

At this point I place it into the array

objArray=rs.GetRows()

But how do I handle things if the rs came back blank?

What happens is that the loop encounters an error?


Jul 19 '05 #1
5 8159
"Croney69" <n@n.com> wrote in message
news:00****************************@phx.gbl...
I am getting information out of a table to place into to
an Array.
rs=DataConn.Execute(strSQL)

At this point I place it into the array

objArray=rs.GetRows()

But how do I handle things if the rs came back blank?

What happens is that the loop encounters an error?


If rs.RecordCount > 0 Then
objArray = rs.GetRows()
'do stuff with array
Else
'handle "no records" condition
End If

HTH-Jon

Jul 19 '05 #2
Sorry I should have mentioned this is a function to
provide an array, which is then use.

I am well a wear of the "if then else" and "eof".
What I want to know is that after calling my function
MyArray= GetInfo(sql)

I will know if to proceed or not depending on the result.

This is what I have seen but it dose not work

1. If not rs.eof then
2. ObjArray=rs.GetRows()
3. Else
4. ObjArray=dataconn.execute("Select 'EOF'").GetRows()
5. End if

I get an error on line 4
-----Original Message-----
You may want to use If Not rs.EOF Then aVar = rs.GetRows () with the codethat you're using.

Ray at home

--
Will trade ASP help for SQL Server help
"Jon Mundsack" <mu******@rochester.rr.com> wrote in messagenews:bg************@ID-168020.news.uni-berlin.de...
"Croney69" <n@n.com> wrote in message
news:00****************************@phx.gbl...
> I am getting information out of a table to place into to > an Array.
> rs=DataConn.Execute(strSQL)
>
> At this point I place it into the array
>
> objArray=rs.GetRows()
>
> But how do I handle things if the rs came back blank?
>
> What happens is that the loop encounters an error?


If rs.RecordCount > 0 Then
objArray = rs.GetRows()
'do stuff with array
Else
'handle "no records" condition
End If

HTH-Jon

.

Jul 19 '05 #3
"Croney69" <n@n.com> wrote in message
news:00****************************@phx.gbl...
Sorry I should have mentioned this is a function to
provide an array, which is then use.

I am well a wear of the "if then else" and "eof".
What I want to know is that after calling my function
MyArray= GetInfo(sql)

I will know if to proceed or not depending on the result.

This is what I have seen but it dose not work

1. If not rs.eof then
2. ObjArray=rs.GetRows()
3. Else
4. ObjArray=dataconn.execute("Select 'EOF'").GetRows()
5. End if

I get an error on line 4


So, if rs contains records, you want ObjArray to contain the GetRows, and if
rs doesn't contain records, you want it to contain a single array element
holding the word EOF? If so, then this is what you want:

If not rs.eof then
ObjArray=rs.GetRows()
Else
ReDim ObjArray(0)
ObjArray(0) = "EOF"
End if

I see no reason to involve the dataconn.execute call and another GetRows,
unless I'm still missing something.

HTH-Jon

Jul 19 '05 #4
AFAIK you need to select FROM a table or other database object (view,
stored proc, etc). And, even if that line 4 syntax worked, you'd be
setting objArray to an array if it had records and a recordset if it
didn't, which will probably cause problems later.

I might set it up like this:
if not rs.EOF then
objArray = rs.GetRows()
else
dim objArray(1,1)
objArray(0,0) = "No Records" ' or whatever flag value you want
end if
Then, I could check objArray(0,0) for "No Records" before processing.

"Croney69" <n@n.com> wrote in message
news:00****************************@phx.gbl...
Sorry I should have mentioned this is a function to
provide an array, which is then use.
I am well a wear of the "if then else" and "eof".
What I want to know is that after calling my function
MyArray= GetInfo(sql)
I will know if to proceed or not depending on the result.
This is what I have seen but it dose not work
1. If not rs.eof then
2. ObjArray=rs.GetRows()
3. Else
4. ObjArray=dataconn.execute("Select 'EOF'").GetRows()
5. End if

I get an error on line 4
-----Original Message-----
You may want to use If Not rs.EOF Then aVar = rs.GetRows

() with the code
that you're using.
Ray at home
--
Will trade ASP help for SQL Server help
"Jon Mundsack" <mu******@rochester.rr.com> wrote in

message
news:bg************@ID-168020.news.uni-berlin.de...
"Croney69" <n@n.com> wrote in message
news:00****************************@phx.gbl...
> I am getting information out of a table to place into to > an Array.
> rs=DataConn.Execute(strSQL)
> At this point I place it into the array
> objArray=rs.GetRows()
> But how do I handle things if the rs came back blank?
> What happens is that the loop encounters an error?
If rs.RecordCount > 0 Then
objArray = rs.GetRows()
'do stuff with array
Else
'handle "no records" condition
End If
HTH-Jon

Jul 19 '05 #5
Croney69 wrote:
I am getting information out of a table to place into to
an Array.
rs=DataConn.Execute(strSQL)

At this point I place it into the array

objArray=rs.GetRows()

But how do I handle things if the rs came back blank?

What happens is that the loop encounters an error?


This is my SOP with GetRows:

if not rs.eof then
ar=rs.getrows
end if
rs.close
set rs=nothing
if isarray(ar) then
'you have data
else
'you don't have data
end if

HTH,
Bob Barrows
Jul 19 '05 #6

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

Similar topics

4
by: Harag | last post by:
Hi All I currently thinking of converting from my little knowledge of VBscript to jScript ASP. With this in mind I'm looking at my current code to see how it will convert over to Jscript. ...
11
by: Laphan | last post by:
Hi All I'm using .getRows() with a local var array instead of doing a recursive loop so that I'm being a good ASP newvbie and closing my object i/o's (the recordset in this case) as quick as...
9
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
3
by: Lyle Fairfield | last post by:
Sometimes we use script or code whose variable types do not correspond to the variable types of other technologies with which they interface. It's possible that our db provider may come to our...
0
by: si | last post by:
I'm very new to using C# in an ASP.NET application, and am used to using the ADO GetRows() method to quickly dump data into a multidimensional array in classic ASP. I am trying to work through...
1
by: FrozenDude | last post by:
Help! I'm a VBA newbie and am having trouble getting the array values retrieved from getRows into a series of individual variables. Here is the query: "Select parcelID, DueDate from tablename" ...
9
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows()...
2
by: davidson1 | last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website.... http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm i downloaded 2 files.... ...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
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.