01.
string
sql =
"SELECT * FROM member WHERE Username = '"
+
this
.txtUsername.Text +
02.
"' AND Password = '"
+
this
.txtPassword.Text +
"' AND Status = '"
+
this
.comboStatus.Text +
"' "
;
03.
comm =
new
SqlCommand(sql, Conn);
04.
da =
new
SqlDataAdapter(comm);
05.
ds =
new
DataSet();
06.
da.Fill(ds,
"pl"
);
07.
if
(ds.Tables[
"Pl"
].Rows.Count > 0)
08.
{
09.
if
(ds.Tables[
"Pl"
].Rows[0][
"Status"
] ==
"1"
)
10.
{
11.
FormMain f =
new
FormMain();
12.
f.Show();
13.
this
.Visible =
false
;
14.
}
15.
else
if
(ds.Tables[
"Pl"
].Rows[0][
"Status"
] ==
"2"
)
16.
{
17.
Form3 f =
new
Form3();
18.
f.Show();
19.
this
.Visible =
false
;
20.
}
21.
}
22.
else
23.
{
24.
MessageBox.Show(
"ไม่สามารถเข้าระบบได้"
);
25.
}