Display number of Records in Label using C# in ASP.Net

Last Reply 9 months ago By AnkitPal

Posted 9 months ago

here is my code,

This code is not in correct form, this code display record, but only 1,

why this code is not displaying my all existing recods

SqlCommand cmd = new SqlCommand("SELECT COUNT(*) column_name FROM table_name", cnn);
    SqlDataReader rdr = cmd.ExecuteReader();
    int count = 0;
    while (rdr.Read())
    label1.Text = "(" + count.ToString() + ") " + "records";


You are viewing reply posted by: AnkitPal 9 months ago.
Posted 9 months ago

Thanks Buddy,

It was perfect answer.

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html