日期:2014-05-17 浏览次数:21113 次
string id = textBox1.Text;
string pwd = textBox2.Text;
string ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;data source=D:\\Bank.mdb";
OleDbConnection con = new OleDbConnection(ConStr);
con.Open();//打开数据库
string sql = "select count(*) from Bank_Account where 账号='" +id+"' and 密码='"+pwd+"' ";
OleDbCommand cmd = new OleDbCommand(sql, con);
int flag=0;
flag=Convert.ToInt32(cmd.ExecuteScalar());
if (flag > 0)
{
MessageBox.Show("登录成功!","登录");
}