首页 > 解决方案 > Insert Query doesn't save data to the database

问题描述

After clicking on the button on the add form, the row is added to the table. But when I restart the program it is not there.

    private void button1_Click(object sender, EventArgs e)
    {
        AddIn add = new AddIn();

        if (add.ShowDialog() == DialogResult.OK)
        {          
  
        documentTableAdapter1.InsertQuery(Convert.ToInt32(add.tb_num.Text),add.data_pic.Value, add.tb_cx.Text, false, Convert.ToInt32(add.tb_pag.Text), null,true, null, 5, false);
 
            dataGridView1.DataSource = inTableAdapter.GetData();
            int k = 0;
        }
     }

It's Access.

标签: c#insertado.net

解决方案


我和往常一样。我自己问了这个问题,我自己回答了。如果也有人发生,则需要在编辑数据库时从 Debug 文件夹中运行程序。否则,添加、编辑、删除都会出现错误的数据库文件。我到了这一步,用的是科学戳的方法。


推荐阅读