07-12-15, 04:17 PM
(آخر تعديل لهذه المشاركة : 07-12-15, 05:04 PM {2} بواسطة khodor1985.)
PHP كود :
{
Form1 frm1 = new Form1();
Form2 frm2 = new Form2();
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0,Data Source=D:\LoginDB.accdb");
con.Open();
OleDbCommand cmd = new OleDbCommand(@"Select DUser,DPassword From tblPerson Where DUser like '" + textBox1.Text + "' and DPassword Like '" + textBox2.Text + "'", con);
OleDbDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
frm2.Show();
frm1.Hide();
}
dr.Close();
con.Close();
}
من خلال Linq to sql :
PHP كود :
{
Form1 frm1 = new Form1();
Form2 frm2 = new Form2();
var GetData = (from x in dbs.tblUsers
where x.DUser == textBox1.Text && x.DPassword == textBox2.Text
select new { x.DUser, x.DPassword }).SingleOrDefault();
if (GetData == null)
{
MessageBox.Show("The User or password is incorrect");
return;
}
if (GetData != null)
{
frm2.Show();
frm1.Hide();
}
}
}
واعبد ربك حتى يأتيك اليقين

