|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Data ReaderDear Experts
How can I count how many records load to the Data Reader And if I run while.dataReader.read() loop. will it automatically move to the next record and loop pls help me Best regards, Anuradha Anuradha,
You can do it in advance with a "Select count from table ...........where..........." integer Count = Cmd.ExecuteScalar(sqlString,conn) (Be aware that while reading somebody else can remove a record) I hope this helps, Cor Show quoteHide quote "Anuradha" <anurad***@lankaequities.com> schreef in bericht news:%236fiu63iGHA.1600@TK2MSFTNGP04.phx.gbl... > Dear Experts > > > > How can I count how many records load to the Data Reader > > And if I run while.dataReader.read() loop. will it automatically move to > the next record and loop pls help me > > > > Best regards, > > Anuradha > > Hello Anuradha,
The DataReader is analogous to a sql forward only cursor. So using strictly a DataReader you can not determine the number of records fetched. You can however count each record as you process it.. in which case you will have a running total during processing and a grand total after processing. If you need a grand total before processing (or during) then I would point you towards a DataTable. -Boo Show quoteHide quote > Dear Experts > > How can I count how many records load to the Data Reader > > And if I run while.dataReader.read() loop. will it automatically move > to the next record and loop pls help me > > Best regards, > > Anuradha >
Threading Advice
Changing text in Report viewer SQL Express or MDB - opinions please stupid questions re: DatagridView Problem with EventLog ExecuteNonQuery Wierdness Reading - Parsing Records From An LDAP LDIF File In .Net? Cloning a RichTextBox Visual Studio 2005 - Code Snippet Manager missing Class/Structure/Enum |
|||||||||||||||||||||||