In my ASP.NET page, i met a problem in connection. Below is the simplified version of my program: It's a very simple and standard ASP.NET connection. What I need to do is to display the retrived data to the textbox: TextBox1.
I wrote this test line: TextBox1.Text= "test string" as below, but it doesn't work. When I move this line before the connection or after the closing of the connection, this line works and display "test string" in TextBox1 area. Anyone can tell me how to solve this problem (rendering text box with the retrived data while in connection). Thanks a million!
mySqlCommand.CommandText ="SELECT SHIFT_CODE FROM dbo.Emp_Mst WHERE BADGE_CD = '007727' ";
SqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
TextBox1.Text= "test string"; //test string not displayed
//TextBox1.Text= "test string"; no problem here then