111,121
社区成员
发帖
与我相关
我的任务
分享if (txtId.Text != "" && txtLoginPwd.Text != "")
{
string sql = string.Format("select Count(Id) from dbo.Users where Id={0} and LoginPwd={1}",
txtId.Text, txtLoginPwd.Text);
SqlCommand command = new SqlCommand(sql, DBHelper.connection);
if (DBHelper.connection.Close()==true)//此处的问题
{
DBHelper.connection.Open();
}
int num = (int)command.ExecuteScalar();
if (num == 1)
{
DBHelper.connection.Close();
frmMainWindow mainWindow = new frmMainWindow();
mainWindow.Show();
this.Hide();
}