嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
namespace supmarket_system
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string SQL = "Data Source=(local);Initial Catalog=supermar_data;Integrated Security=True";
SqlConnection conn = new SqlConnection(SQL);
SqlCommand mycomm = new SqlCommand(SQL,conn);
SqlDataAdapter myDA = new SqlDataAdapter(mycomm);
string mySQL = "select Name,Pass from Employee where Name ='";
mySQL =textBox1.Text "' and Pass ='" textBox2.Text "'";
conn.Open();
mycomm.CommandText = mySQL;
mycomm.Connection = conn;
myDA.SelectCommand = mycomm;
DataSet DSetEmp = new DataSet();
myDA.Fill(DSetEmp,"Employee");
if (textBox1.Text == "" || textBox2.Text == "")
{
MessageBox.Show("请输入用户名和密码!");
}
try
{
if (DSetEmp.Tables["Employee"].Rows.Count == 0)
{
MessageBox.Show("用户名或者密码不正确,请重新输入!");
return;
}
else
{
Form2.isLogin = true;
Form2.Username = this.textBox1.Text;
Form2 form2 = new Form2();
form2.ShowDialog();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}