Click here to Skip to main content
15,904,828 members
Home / Discussions / C#
   

C#

 
AnswerRe: downloading pdf on a desktop folder Pin
Henry Minute30-May-09 0:12
Henry Minute30-May-09 0:12 
QuestionHow to attach a new process with existing process Pin
Jacobb Michael29-May-09 23:50
Jacobb Michael29-May-09 23:50 
AnswerRe: How to attach a new process with existing process Pin
Rajesh R Subramanian30-May-09 0:13
professionalRajesh R Subramanian30-May-09 0:13 
AnswerRe: How to attach a new process with existing process Pin
Anubhava Dimri30-May-09 0:27
Anubhava Dimri30-May-09 0:27 
GeneralRe: How to attach a new process with existing process Pin
Jacobb Michael31-May-09 18:34
Jacobb Michael31-May-09 18:34 
AnswerRe: How to attach a new process with existing process Pin
SimpleData30-May-09 1:38
SimpleData30-May-09 1:38 
Questionto store datareader values in array Pin
priya1515s29-May-09 23:45
priya1515s29-May-09 23:45 
AnswerRe: to store datareader values in array Pin
Mycroft Holmes29-May-09 23:59
professionalMycroft Holmes29-May-09 23:59 
Questionhi Pin
hamed02129-May-09 23:44
hamed02129-May-09 23:44 
Questionhi Pin
hamed02129-May-09 23:44
hamed02129-May-09 23:44 
Questionhi Pin
hamed02129-May-09 23:42
hamed02129-May-09 23:42 
Questionhi Pin
hamed02129-May-09 23:40
hamed02129-May-09 23:40 
AnswerRe: hi Pin
Anubhava Dimri29-May-09 23:42
Anubhava Dimri29-May-09 23:42 
AnswerRe: hi Pin
Hamed Musavi29-May-09 23:52
Hamed Musavi29-May-09 23:52 
AnswerRe: hi Pin
Mohammad Dayyan29-May-09 23:56
Mohammad Dayyan29-May-09 23:56 
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 

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.