using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace bookglxt
{
public partial class 读者登入 : Form
{
public 读者登入()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
check();
}
private void check()
{
SqlConnection conn = new
SqlConnection("server=;database=bookgxlt;uid=jxl;pwd=123");
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from reader where 卡号='" + textBox1.Text + "'and 密
码='" + textBox2.Text + "'";
try
{
conn.Open();
if (cmd.ExecuteScalar() != null)
{
读者操作 f1 = new 读者操作();
f1.Show();
}
else
{
MessageBox.Show("登录失败!", "系统提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
}
catch (Exception err)
{
MessageBox.Show(err.Message, "系统提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
finally
{
conn.Close();
}
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace bookglxt
{
public partial class 管理员登入 : Form
{
public 管理员登入()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
check();
}
private void check()
{
SqlConnection conn = new
SqlConnection("server=;database=bookgxlt;uid=jxl;pwd=123");
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Admin where LoginName='" + textBox1.Text +
"'and LoginPwb='" + textBox2.Text + "'";
//SqlDataReader dr;
try
{
conn.Open();
if (cmd.ExecuteScalar() != null)
{
操作界面 f1 = new 操作界面();
f1.Show();
}
else
{
MessageBox.Show("登录失败!", "系统提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
}
catch (Exception err)
{
MessageBox.Show(err.Message, "系统提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
finally
{
conn.Close();
}
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}