string data_username = textBox1.Text;
string data_userpassword = textBox2.Text;//变量赋值
SqlConnection conn = new SqlConnection();//建立连接
conn.ConnectionString = @"Server=.;Integrated Security=True;" + "DataBase=JJJJJJJJ";//连接字符串
SqlCommand cmd = new SqlCommand("select * from USER_TABLE", conn);//建立命令
cmd.CommandText = "insert into USER_TABLE(ID,PS) values('" + data_username + "','" + data_userpassword + "')";//插入记录
cmd.Connection = conn;
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
MessageBox.Show("添加成功!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.textBox1.Text = "";
this.textBox2.Text = "";