try
                {
                    string StrSQL = "INSERT INTO id(name,mima,question,answer)VALUES('";
                    StrSQL += this.textBox1.Text + "','";
                    StrSQL += this.textBox2.Text + "','";
                    StrSQL += this.comboBox2.Text + "','";                    StrSQL += this.textBox5.Text + "','";                    this.oleDbDataAdapter1.SelectCommand.CommandText = StrSQL;
                    this.oleDbDataAdapter1.SelectCommand.Connection = this.oleDbConnection1;                    this.oleDbConnection1.Open();                    this.oleDbDataAdapter1.SelectCommand.ExecuteNonQuery();                    this.oleDbConnection1.Close();
                }
                catch
                {                }
加了断点看到每行都执行了,但是数据库的表里面并没有插如新的行,这是怎么回事呢?

解决方案 »

  1.   

    在你的CATCH里家上THROW,看看到底是什么错误啊!!
    而且你前面家的是4列(name,mima,question,answer)
    但后面却插入了解情况个值('"; 
                        StrSQL += this.textBox1.Text + "','"; 
                        StrSQL += this.textBox2.Text + "','"; 
                        StrSQL += this.comboBox2.Text + "','";                     StrSQL += this.textBox5.Text + "','"; 
    看看是不是这个问题.