private void button6_Click(object sender, EventArgs e)
        {
            if(textBox1.Text.Length<1|textBox2.Text.Length<1|textBox3.Text.Length<1|textBox4.Text.Length<1|
                textBox5.Text.Length<1|textBox6.Text.Length<1|textBox7.Text.Length<1|textBox8.Text.Length<1|
                textBox9.Text.Length<1|textBox10.Text.Length<1|textBox11.Text.Length<1)
            {
                MessageBox.Show("必须填完所有信息","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
            else
            {
                try
                {
                    string strSQL = "Insert Into 客户(客户ID,公司名称,联系人姓名,联系人头衔,联系地址,城市,邮政编码,电话,地区,国家,传真)values('";
                    strSQL +=this.textBox1.Text+"','";
                    strSQL +=this.textBox2.Text+"','";
                    strSQL +=this.textBox3.Text+"','";
                    strSQL +=this.textBox4.Text+"','";
                    strSQL +=this.textBox5.Text+"','";
                    strSQL +=this.textBox6.Text+"','";
                    strSQL +=this.textBox7.Text+"','";
                    strSQL +=this.textBox8.Text+"','";
                    strSQL +=this.textBox9.Text+"','";
                    strSQL +=this.textBox10.Text+"','";
                    strSQL +=this.textBox11.Text+"')";
                    oleDbcommand1.CommandText = strSQL;
                    oleDbcommand1.Connection = oleDbConnection1;
                    oleDbConnection1.Open();                        //打开数据库连接
                    oleDbcommand1.ExecuteNonQuery();                //执行SQL语句
                    oleDbConnection1.Close();
                    
                    this.dataSet1.Tables["客户"].Rows[this.MyBond.Position].BeginEdit();
                    this.dataSet1.Tables["客户"].Rows[this.MyBond.Position].EndEdit();
                    this.dataSet1.AcceptChanges();
                    MessageBox.Show("恭喜增加数据记录成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception Err)
                {
                    MessageBox.Show("增加数据库记录失败:" + Err.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (oleDbConnection1.State == ConnectionState.Open)
                    {
                        this.oleDbConnection1.Close();
                    }
                }
            }
        }
---------------------
这是一个简单的读写Access数据的实例.  上面的是其中一个"增加数据"的事件处理程序
变异没有问题.问题是可以更改DataSet中的数据.但是再次编译后又恢复到原来的了.就是说数据库中的无法真正增加.
是哪里的问题呢?请高手帮忙.谢谢



 
											






 
	    

 
	
 
											

