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 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