110,556
社区成员
发帖
与我相关
我的任务
分享
string connString = "Data Source=.;Initial Catalog=STManagement;User ID=sa;Pwd=123456";
SqlConnection connection = new SqlConnection(connString);
connection.Open();
string sql = "insert into STManagement BasinMessage(学号,姓名,密码,性别,生日,学院,邮箱,联系方式)values('"+this.id.Text+"','"+this.name.Text+"','"+this.pwd.Text+"','"+this.sex.Text+"','"+this.year.Text+"','"+this.month.Text+"','"+this.day.Text+"','"+this.academy.Text+"','"+this.email.Text+"','"+this.call.Text+"')";
SqlCommand com = new SqlCommand(sql, connection);//执行SQL语句
connection.Close();
MessageBox.Show("注册成功", "注册", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
-------------------不就是简单的""里添加变量么?