1,978
社区成员




private void button1_Click(object sender, EventArgs e)
{
string userName = textBox1.Text;
string password = textBox2.Text;
string role = comboBox1.Text;
//初始化数据库连接,数据库的路径是 C:\企业人事管理系统.mdf
OleDbConnection con = new OleDbConnection(@"C:\企业人事管理系统.mdf");
con.Open();
//构造sql插入操作字符串
string commandText = "insert into 用户信息表(用户名,密码,类别)values('{0}','{1}','{2}')";
commandText = string.Format(commandText, userName, password, role);
//执行操作
OleDbCommand com = new OleDbCommand(commandText,con);
com.ExecuteNonQuery();
//草你妹!
MessageBox.Show("草你妹!");
}