急!!!运行command.ExecuteNonQuery()时‘(’有语法错误,请指教
大家好,我是个菜鸟新手,在编写一个windows型注册窗体时遇到了个麻烦,已经搞了一天,试了很多种方法都没结果,很头痛,请哪位高手帮帮我。具体情况如下:
模块代码
private void btnYes_Click(object sender, EventArgs e)
{
string yh = txtName.Text;
string m = txtPwd1.Text;
string qrm = txtPwd2.Text;
string connString = @"Data Source = sun-PC;Initial Catalog = 医院药品管理;Integrated Security = True";
SqlConnection connection = new SqlConnection(connString);
string sql =String.Format(" insert into [User](yhm,mm,qrmm)values('{0}','{1}','{2}')",yh,m,qrm);
if ( m == qrm)
{
connection.Open();
SqlCommand command = new SqlCommand(sql, connection);
command.ExecuteNonQuery();
connection.Close();
MessageBox.Show("您已成功注册", "注册成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
注册界面 enrollForm = new 注册界面();
enrollForm.Close();
this.Visible = false;
登陆界面 enterForm = new 登陆界面();
enterForm.Show();
this.Visible = false;
}
else
{
MessageBox.Show("您两次输入的密码不一致,请重新输入", "注册失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
&n