110,538
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
SqlCommand s;
s = new SqlCommand();
s.Connection = p;
string str = string.Format("select * from 用户表 where 用户ID={0} and 用户密码={1}",this.textBox1.Text,this.textBox2.Text);
s.CommandText = str;
s.CommandType = CommandType.Text;
SqlDataReader sdr = s.ExecuteReader();
// sdr.Read();
if(sdr.Read())
{
MessageBox.Show("登录成功!");
主窗体 p1 = new 主窗体();
p1.Show();
}
else
{
MessageBox.Show("用户名与密码不匹配!");
}
}
string sql="select * from xxoo where id='"+TextBox1.Text+"'";