helo i want to count values from database in c# please help me?

Recommended Answers

Can you clarify?

Do you want to count the number of rows in a table...for example...
SELECT COUNT(*) FROM tableName

Jump to Post

All 4 Replies

Can you clarify?

Do you want to count the number of rows in a table...for example...
SELECT COUNT(*) FROM tableName

i want to count the number of values in a particular column. plz give the sqlcommand with c#coding. Am using asp.net. plz tell as soon as possible

this may help........

cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select count(FEILD NAME) from TABLE NAME";
da.SelectCommand = cmd;
da.Fill(dt);

int count =int.parse(dt.Rows[0][0].ToString());

Response.write(count.ToString());

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.