I want to get the retrived records count from the OleDbDataReader
in C# ?
strQuery = "SELECT * FROM Table_Name" ;
dbCommand = new OleDbCommand(strQuery, dbConnection);
dbReader = dbCommand.ExecuteReader();
//Now how to get RowCount from the Table after this.
Any help is appreciated.
Thanks.
For more detail : Get row count by 'ExecuteScalar'
Make use of ExecuteSclar()
rather than going for read
function.
SqlCommand cmd = new SqlCommand("SELECT count(*) FROM " + Table_Name, conn);
try
{
conn.Open();
int total = (Int32)cmd.ExecuteScalar();
}