Click here to Skip to main content
16,016,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while loading the page in asp dot net using c sharp, i need to display the maximum value of the column(in table ) in a label boxs always

Select max(refno+1) from master.i am new in asp pls,help
Posted
Comments
Peter Leow 2-Jun-15 10:22am    
It should be
select max(refno) + 1 from master
By the way, what is the purpose of this maximum value?
Unni R 2-Jun-15 10:42am    
I need to display this number always SqlDatareader cmd =new SqlDatareader("select max(refno+1) from master"con);
DataSet ds=new DataSet();
cmd.fill(ds);
label.text=ds;
But its not wrking

1 solution

Steps


So, steps are like...

  1. Create Connection Object.
  2. Create Command Object.
  3. Assign appropriate query and Connection to the Command Object.
  4. Open the Connection.
  5. Execute your Command using proper SqlCommand Method[^] to get the results.
  6. Then bind value with the Label.

Example


DataBinding DropDownList Label and Textbox Controls in ASP.Net[^].
 
Share this answer
 
v3

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