SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand("select * from Employee where EmpID =@u and pass =@p ", con);
if (con.State == ConnectionState.Closed)
con.Open();
cmd.Parameters.Add("@u", SqlDbType.VarChar, 50).Value = txtEmpID.Text;
cmd.Parameters.Add("@p", SqlDbType.VarChar, 50).Value = txtPass.Text;
using (SqlDataReader dr = cmd.ExecuteReader())
{
if ((dr.Read() == true))
{
มาตรวจสอบเปิดFormที่นี้ครับ
}