private void swipe_button_Click(object sender, EventArgs e) { String ID_givenbyUSER = IDtxtBox.Text; SqlConnection sqlConn = null; sqlConn = new SqlConnection("Data Source=HOME-PC\\SQLEXPRESS;Initial Catalog=ABC_SchoolDB;Integrated Security=True"); sqlConn.Open(); SqlCommand cmd = new SqlCommand("select Student_Name from dbo.Sheet@Attendance where Serial_Id=" + " ' " + ID_givenbyUSER + " ' ", sqlConn); SqlDataReader sqlReader = cmd.ExecuteReader(); richTxtBox.Clear(); richTxtBox.AppendText("Hi buddy "); //This line works while (sqlReader.Read()) { richTxtBox.AppendText("Hi buddy "); //But,Its not work pwdbox.Text = (sqlReader["Student_Name"].ToString()); //It also not work } if (sqlConn != null) { sqlConn.Close(); sqlConn = null; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)