PC Review


Reply
Thread Tools Rate Thread

Accessing oledb reader without moving to next record

 
 
John
Guest
Posts: n/a
 
      7th Jun 2009
Hi

How can I check if an oledb reader returned any records after ExecuteReader,
without fetching the next record?

Thanks

Regards


 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      8th Jun 2009
Hi John,

Use a Select string with a Count for the same "where" and use an
executescalar

Cor

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> How can I check if an oledb reader returned any records after
> ExecuteReader, without fetching the next record?
>
> Thanks
>
> Regards
>


 
Reply With Quote
 
William Vaughn MVP
Guest
Posts: n/a
 
      8th Jun 2009
MyDataReader.HasRows
Repeating the query with a Count? Excuse me? Repeat the whole query process
just to get a count? Expensive, unnecessary and inaccurate. What if a row is
added the instant after your "Count" query? Wrap them in a transaction? That
just slows down everyone else...

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________



"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> How can I check if an oledb reader returned any records after
> ExecuteReader, without fetching the next record?
>
> Thanks
>
> Regards
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing oledb reader without moving to next record John Microsoft VB .NET 2 8th Jun 2009 04:51 PM
OLEDB data reader not reading Extended ASCII values properly -Help Vijayakumar S via .NET 247 Microsoft ADO .NET 1 8th Sep 2004 10:31 PM
accessing outlook by oledb André Dias Microsoft Outlook Discussion 1 23rd Apr 2004 02:07 PM
accessing outlook by oledb André Dias Microsoft Outlook VBA Programming 1 23rd Apr 2004 02:07 PM
accessing outlook by oledb André Dias Microsoft ADO .NET 0 22nd Apr 2004 07:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:05 PM.