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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 beginner to sql, need help

Author  Topic 

balamreddy
Starting Member

2 Posts

Posted - 2010-12-17 : 13:59:18
hi
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#.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-17 : 14:07:13
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 - 2010-12-17 : 18:17:35
[code]select max([value]) from [database table][/code]

CODO ERGO SUM
Go to Top of Page

balamreddy
Starting Member

2 Posts

Posted - 2010-12-18 : 00:45:24
how can i get that max value into a label using c#


quote:
Originally posted by Michael Valentine Jones

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


CODO ERGO SUM

Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-12-18 : 02:04:29
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.

label.text=Convert.ToString(cmd.ExecuteScalar)


PBUH

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-12-18 : 03:08:27
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

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-12-22 : 11:51:56
OP simply read some of Peter's replies where Peter did his mind reading act, and OP assumed OP could get an answer also.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -