Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count number of rows in MySQLDatabase

Status
Not open for further replies.

ersachinjain

Programmer
May 26, 2010
7
US
Hi

My code connects to the mysql database and then retrieves the values from the database. I want to know the number of rows that are fetched from the database. Any one can help.

my code is :

C_mysqlconnection = new MySqlConnection(str_connectionstring);
C_mysqlconnection.Open();
String str_selectquery = "select * from " + str_tablename;

ArrayList arraylist_records;

MySqlCommand mysqlcommand = new MySqlCommand(str_selectquery, C_mysqlconnection);

MySqlDataReader mysqlreader = mysqlcommand.ExecuteReader();
 
Hi

I tried but there is no such property ResultCount. How ever there is FieldCount property. Is this the one you were refering to.
 
no that is not the one

what version of VS are you using?
Did you download a mySQL dll or is it native to VS?
 
i have downloaded a connector of mqsql 6. something for .net. But it does not have that property.
 
Ok, well, if it is not native to ASP.NET, then you will have to find support documentation for it. There is no way for us to help you if you don't know what you actually downloaded. There may not be a way to do it at all with a data reader. I would just use a datatable and get the rowcount from that.
 
its actually mysql connector 6.2.2.0. The property that u had mentioned about, which class does that property belong to.

Thanks
 
You will have to find the documentation specific to your download. I found that property using Google.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top