|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Accessing oledb reader without moving to next recordHi
How can I check if an oledb reader returned any records after ExecuteReader, without fetching the next record? Thanks Regards Hi John,
Use a Select string with a Count for the same "where" and use an executescalar Cor Show quoteHide quote "John" <info@nospam.infovis.co.uk> wrote in message news:eDmqS975JHA.4404@TK2MSFTNGP04.phx.gbl... > Hi > > How can I check if an oledb reader returned any records after > ExecuteReader, without fetching the next record? > > Thanks > > Regards > 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... -- Show quoteHide quote__________________________________________________________________________ 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" <info@nospam.infovis.co.uk> wrote in message news:eDmqS975JHA.4404@TK2MSFTNGP04.phx.gbl... > Hi > > How can I check if an oledb reader returned any records after > ExecuteReader, without fetching the next record? > > Thanks > > Regards >
My.Settings Questions
Too many items in listbox? Text Popup RichTextBox How to pass a structure to a form subroutine Enable/Disable Checkboxes based on Parent Check value? Copying Windows Form to another project Odd problem with Me.Hide() and Me.Visible = False Extarcting email attachmnets from exchange How to access a scanner in VB.NET |
|||||||||||||||||||||||