Click here to Skip to main content
15,921,548 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How to get max(Count) value from sqlserver database as a integer. Where Count is a column in the table.
Posted
Comments
Tejas Vaishnav 6-Feb-13 23:56pm    
can you provide your database table schema.

in your windows form apllication:

C#
SqlCommand cmd=new SqlCommand();
cmd.ExecuteNonQuery("Select Max(Count) From TableName",con);
sqlDataReader dr=new SqlDataReader();
dr.read();

int lnCount = Convert.ToInt32(dr[0].toString());
 
Share this answer
 
v2
SQL
select max(column name) from tablename



[Edit] select max(column name ex:salary) from tablename [/Edit]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900