|
-
May 11th, 2007, 06:18 AM
#1
Thread Starter
Member
Datareader.HasRows not supported ?
How come the Datareader.Hasrows function doesnt work unless you set Its contents Scrollable how do i read through the datareader effectively ?
I've been using Datareader.read = false if its empty and after that read one record.
How do i check if there's more then one record in it and go through it ?
Ive tried , While Datareader.read
or Do while Datareader.read
but it ends without reading anything , while i know it has something.
-
May 11th, 2007, 11:43 AM
#2
Re: Datareader.HasRows not supported ?
I can't look anything up, but I always use a loop for datareaders:
Do while DataReader.Read
(at least I'm pretty sure I do).
Since that is what you are doing, then it sure looks like there is something else going wrong. You say that you know there is something there, but every test you are trying seems to indicate that there actually isn't. How do you know that there is something?
How about running the same query as ExecuteScalar, and see whether you get something back. It sure seems like the DataReader part is not the problem.
My usual boring signature: Nothing
 
-
May 11th, 2007, 12:10 PM
#3
Fanatic Member
Re: Datareader.HasRows not supported ?
i always use for multiple items
While l_datareader.Reader
'do whatever
End WHile
and for a single item return
If l_datareader.Read
End If
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
May 11th, 2007, 03:34 PM
#4
Re: Datareader.HasRows not supported ?
Still should have worked. The loop ending without reading anything strongly suggests that the reader is empty.
My usual boring signature: Nothing
 
-
May 12th, 2007, 04:45 AM
#5
Thread Starter
Member
Re: Datareader.HasRows not supported ?
The funny thing is that datareader.executeresultset Does give me 2 or 3 items.
and i have to set the resulsetoptions.scrollable , its very strange.
-
May 12th, 2007, 09:18 AM
#6
Re: Datareader.HasRows not supported ?
That is strange. I have never had that problem, nor have I ever used ExecuteResultSet, but that sure makes me suspicious. I have no access to much of anything at the moment, and won't until tomorrow, but that method makes me think that you are creating the datareader in a way that is different from what I am expecting.
My usual boring signature: Nothing
 
-
May 14th, 2007, 03:22 AM
#7
Thread Starter
Member
Re: Datareader.HasRows not supported ?
the Do while datareader.read works now, but with executeresultset though
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|