窗体应用程序登录 vs2010提示没有出错,但是按了登录的button就是没反应

private void button7_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
}

//提交晚归登记信息
private void button8_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
{
MessageBox.Show("请输入学号");
return;
}
else
{
MessageBox.Show("请输入姓名");
return;
}

//向数据库中插入数据
SqlConnection conn = new SqlConnection(ConnStr);
string sql = @"insert into Late (学号,姓名,性别,房间号,所属学院) values(@学号,@姓名,@性别,@房间号,@所属学院)";
conn.Open();
SqlCommand comm = new SqlCommand(sql, conn);
comm.Parameters.Add(new SqlParameter("@学号", textBox1.Text));
comm.Parameters.Add(new SqlParameter("@姓名", textBox2.Text));
comm.Parameters.Add(new SqlParameter("@性别", textBox3.Text));
comm.Parameters.Add(new SqlParameter("@房间号", textBox4.Text));
comm.Parameters.Add(new SqlParameter("@所属学院", textBox5.Text));
int result = comm.ExecuteNonQuery();
if (result > 0)
{
MessageBox.Show("输入成功!!"); Form1_Load(sender, e);
}
else
{
MessageBox.Show("输入失败!!\r\n请重新输入"); Form1_Load(sender, e);
}
conn.Close();

}
}
}

第1个回答  2016-06-17
你的数据库连接语句呢。可以远程么追问

可以远程,无偿远程帮助?

追答

怎么远程,我帮你看看吧。

追问

WIN7 系统里不是有远程功能吗

追答

额,那个不能直接远程的,你的电脑IP又不是公网IP。。。你Q多少

追问

1012863662

追答

解决了??????????