C# 用sql语句向access数据库中添加数据 显示成功了 为什么数据库中没有该条数据呢?
代码如下:privatevoidbutton1_Click(objectsender,EventArgse){stringstr="Provider=Microsoft....
代码如下:
private void button1_Click(object sender, EventArgs e)
{
string str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|储层伤害预测.mdb";
OleDbConnection conn = new OleDbConnection(str);
conn.Open();
string command="insert into userlist(userid,password,phone,Email) values('"+textBox1.Text+"','"+textBox2.Text+"','"+textBox3.Text+"','"+textBox4.Text+"')";
OleDbCommand cmd = new OleDbCommand(command ,conn);
OleDbCommand cmmd = new OleDbCommand("update userlist", conn);
conn.Close();
MessageBox.Show("注册成功!谢谢使用!");
} 展开
private void button1_Click(object sender, EventArgs e)
{
string str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|储层伤害预测.mdb";
OleDbConnection conn = new OleDbConnection(str);
conn.Open();
string command="insert into userlist(userid,password,phone,Email) values('"+textBox1.Text+"','"+textBox2.Text+"','"+textBox3.Text+"','"+textBox4.Text+"')";
OleDbCommand cmd = new OleDbCommand(command ,conn);
OleDbCommand cmmd = new OleDbCommand("update userlist", conn);
conn.Close();
MessageBox.Show("注册成功!谢谢使用!");
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询