当用户输入用户名,密码后进入主Main, 同时关闭登录的Form1, 可是我这里this.Close();却关闭不了,为什么不能关闭?
Form1.cs:
private void button1_Click(object sender, EventArgs e)
{
Data ds = new Data();
string name = uname.Text.Trim();
string password = pwd.Text.Trim();
string strSql = "SELECT * FROM admin where name='" + name + "' and password='" + password + "'";
if (ds.GetCount(strSql) > 0)
{
Main wm = new Main();
wm.ShowDialog();
this.Close();
}
else
{
MessageBox.Show("请正确输入你的用户名和密码");
uname.Text = "";
pwd.Text = "";
uname.Focus();
}
[此贴子已经被作者于2006-10-17 22:43:54编辑过]