Last post May 01, 2012 09:31 PM by Decker Dong - MSFT
Apr 30, 2012 08:29 AM|cenk1536|LINK
On my web page I have some Textboxes and I am getting data from database into datatable. I wonder if I can set those data into Textboxes?
Apr 30, 2012 08:31 AM|gaikwad_anil1987|LINK
May 01, 2012 09:31 PM|Decker Dong - MSFT|LINK
I wonder if I can set those data into Textboxes?
Of course you can——Just try to use SqlCommand+SqlConnection to read a specific record out and then assign to TextBoxes' values one by one：
using(SqlCommand cmd = new SqlCommand("select top 1 * from xxx where [primarykey]=@value",new SqlConnection("……")))
SqlDataReader dr = cmd.ExecuteReader();
TextBox1.Text = dr[index such as 0].ToString();