Last post Aug 21, 2009 11:16 AM by RatheeshC
Aug 21, 2009 09:49 AM|abhinash|LINK
i want to call database column in label control & not in grid view but i'm not gettin the desired output .........
it instead of showing data of column simply showing 'label' as output
cmd=new sqlcommand ("select column1 from table where column2==1000");
Aug 21, 2009 10:22 AM|SGWellens|LINK
That's wrong, you only need one =.
Aug 21, 2009 10:43 AM|abhinash|LINK
i've tried by using '=' also but still problem not solved
is there any other code of doing this
Aug 21, 2009 10:48 AM|RatheeshC|LINK
cmd = new SqlCommand("select column1 from table where column2 = 1000",con);
If it is not working try this
cmd = new SqlCommand("select column1 from table where column2 = '1000'",con);
Aug 21, 2009 10:51 AM|abhinash|LINK
is my approach of showing database in label is write
Aug 21, 2009 10:55 AM|SGWellens|LINK
Is that line executing?
By the way, there is no tostring, it's ToString. If you post code that is different than what is actually running, you will not have much success getting help.
Aug 21, 2009 11:16 AM|RatheeshC|LINK
Yes.. Your code does not confirms the standard...
sqlconnection con; should be SqlConnection con
sqlcommand cmd; should be SqlCommand cmd
sqldatareader rdr; should be SqlDataReader rdr
rdr=cmd.executereader(); should be rdr = cmd.ExecuteReader() etc..
Try to put an if condition before the while..Make sure that the if condition gives you true