Click here to Skip to main content
15,885,278 members
Home / Discussions / C#
   

C#

 
Questionhi Pin
hamed02129-May-09 23:40
hamed02129-May-09 23:40 
QuestionUser-Informations on DB or in RAM? Pin
softwarejaeger29-May-09 22:48
softwarejaeger29-May-09 22:48 
AnswerRe: User-Informations on DB or in RAM? Pin
Manas Bhardwaj29-May-09 23:30
professionalManas Bhardwaj29-May-09 23:30 
QuestionReceive emails using POP3 Pin
alisolution29-May-09 22:47
alisolution29-May-09 22:47 
AnswerRe: Receive emails using POP3 Pin
Nicholas Butler29-May-09 23:15
sitebuilderNicholas Butler29-May-09 23:15 
JokeRe: Receive emails using POP3 Pin
Mycroft Holmes30-May-09 0:11
professionalMycroft Holmes30-May-09 0:11 
QuestionHow to display a column value from database to label Pin
Mads11529-May-09 21:23
Mads11529-May-09 21:23 
AnswerRe: How to display a column value from database to label [modified] Pin
Prasanth MS29-May-09 21:56
Prasanth MS29-May-09 21:56 
Problem I traced is
1) The SQL Command is "INSERT" instead of select command. Insert Command insert data into tables and return the number of records inserted.

2) DataReader returns object. You have to convert the same into the data type you want eg. code
{
object obj = dr.read();
Convert.ToString(obj);
}

SO YOUR REQUIRED CODE SHALL BE LIKE FOLLOWS
----
SqlConnection con = new SqlConnection("server=AAB;database=ab;uid=sa;pwd=pass");
con.Open();

SqlCommand cmd = new SqlCommand("SELECT * FROM myTable", con);
SqlDataReader dr = cmd.ExecuteReader();

while (!dr.IsDbNull())
{
Object obj = dr.Read();
label1.Text= obj.ToSring();
}
dr.Close();


---

try and reply.

modified on Saturday, May 30, 2009 4:09 AM

GeneralRe: How to display a column value from database to label Pin
Mads11529-May-09 22:28
Mads11529-May-09 22:28 
Questionprint job Pin
hassannikoo29-May-09 21:13
hassannikoo29-May-09 21:13 
AnswerRe: print job Pin
I Believe In GOD30-May-09 5:26
I Believe In GOD30-May-09 5:26 
QuestionImage Encrypton Pin
saadtahir29-May-09 21:01
saadtahir29-May-09 21:01 
AnswerRe: Image Encrypton Pin
Manas Bhardwaj29-May-09 23:33
professionalManas Bhardwaj29-May-09 23:33 
GeneralRe: Image Encrypton Pin
saadtahir30-May-09 18:56
saadtahir30-May-09 18:56 
AnswerRe: Image Encrypton Pin
Rajesh R Subramanian30-May-09 0:19
professionalRajesh R Subramanian30-May-09 0:19 
QuestionIPC Pin
Hamed Musavi29-May-09 20:07
Hamed Musavi29-May-09 20:07 
AnswerRe: IPC Pin
Nicholas Butler29-May-09 23:21
sitebuilderNicholas Butler29-May-09 23:21 
GeneralRe: IPC Pin
Hamed Musavi29-May-09 23:32
Hamed Musavi29-May-09 23:32 
GeneralRe: IPC Pin
Hamed Musavi29-May-09 23:42
Hamed Musavi29-May-09 23:42 
GeneralRe: IPC Pin
Nicholas Butler30-May-09 1:25
sitebuilderNicholas Butler30-May-09 1:25 
GeneralRe: IPC Pin
Hamed Musavi30-May-09 4:08
Hamed Musavi30-May-09 4:08 
GeneralRe: IPC Pin
Hamed Musavi30-May-09 23:43
Hamed Musavi30-May-09 23:43 
GeneralRe: IPC Pin
Nicholas Butler30-May-09 23:45
sitebuilderNicholas Butler30-May-09 23:45 
QuestionRajdeep.net, a new low PinPopular
EliottA29-May-09 11:18
EliottA29-May-09 11:18 
AnswerRe: Rajdeep.net, a new low Pin
Anthony Mushrow29-May-09 15:43
professionalAnthony Mushrow29-May-09 15:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.