Using vs2005
ok folks, i am currently trying to use a dataset that pulls data from sql server database and wish to show the final results in a label.
Database Name: miniCMS
From Table: Page
Column: PageID that equals 1
Hope this helps you answer my question.
Please point me in the right direction or even show me how to do this.
Thanks in advanced


Adnan Hasan41 reputationPosted Jul 17, 2006, 4:44 AM EDT
1:Make a connection,
2:Make a command
3:Make a SqlDataAdapter
4:Use DataTable(no need to use DataSet in current scenario) to fill the data from DataAdpater
5:Use DataReader (if yes, then skip step 3 and 4, no need)
6:Browse the DataTable or DataSet to get the value and pu that value on Lable.Text
Thank you
Adnan Hasan
Ranjeet Singh5 reputationPosted Jul 18, 2006, 4:36 AM EDT
SqlConnection
con;SqlDataAdapter adopt;
DataSet ds=new DataSet();
con=new SqlConnection("yoyr connection string");
adopt=new SqlDataAdapter("select PageID from Page where PageID=1",con);
adopt.fill(ds);
Label1.Text=ds.Tables[0].Rows[0]["PageID"].ToString();