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

Recommended Answers

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.