Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 beginner to sql, need help
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 12/17/2010 :  13:59:18  Show Profile  Reply with Quote
Help me in the above case

To print the max value on the label by getting it from database table.
Kindly the code to be used is C#.

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 12/17/2010 :  14:07:13  Show Profile  Visit webfred's Homepage  Reply with Quote
I must say that you are very clear...

No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 12/17/2010 :  18:17:35  Show Profile  Reply with Quote
select max([value]) from [database table]

Go to Top of Page

Starting Member

2 Posts

Posted - 12/18/2010 :  00:45:24  Show Profile  Reply with Quote
how can i get that max value into a label using c#

Originally posted by Michael Valentine Jones

select max([value]) from [database table]


Go to Top of Page

Flowing Fount of Yak Knowledge

2937 Posts

Posted - 12/18/2010 :  02:04:29  Show Profile  Reply with Quote
Use a command object of C#.Something like this

SqlCommand cmd = new SqlCommand(sql, conn);

where sql is the actual query to get the max value 
from the table and conn is the connection string.
Then set the value of the label to value returned from the command object.



Edited by - Sachin.Nand on 12/18/2010 02:04:57
Go to Top of Page

Flowing Fount of Yak Knowledge

South Africa
4507 Posts

Posted - 12/18/2010 :  03:08:27  Show Profile  Visit GilaMonster's Homepage  Reply with Quote
Seriously now. Read over what you posted and imagine that you know nothing about the scenario. Can you really figure out what's been asked? Why do you think we can?

Gail Shaw
SQL Server MVP
Go to Top of Page

Flowing Fount of Yak Knowledge

2167 Posts

Posted - 12/22/2010 :  11:51:56  Show Profile  Reply with Quote
OP simply read some of Peter's replies where Peter did his mind reading act, and OP assumed OP could get an answer also.
How to ask:

For ultra basic questions, follow these links.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000