con.Open();//打开通道
try
{
string sql = "insert into 表1 values('"+this.textBox1.Text+"','"+this.textBox2.Text+"','"+this.textBox3.Text+"','"+this.textBox4.Text+"','"+this.textBox5.Text+"','"+this.textBox6.Text+"','"+this.textBox7.Text+"','"+this.textBox8.Text+"','"+this.textBox9.Text+"')";//SQL
com = con.CreateCommand();
= sql;//执行SQL
com.ExecuteNonQuery();//就是刷新数据库就这个意思!
MessageBox.Show("保存成功");
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
textBox8.Text = "";
textBox9.Text = "";
}
catch(OleDbException ee)
{
string str=ee.Message.ToString();
MessageBox.Show("对不起,您输入的数据已存在");
}
con.Close();//关闭通道