c# - 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.
解决方案
我和往常一样。我自己问了这个问题,我自己回答了。如果也有人发生,则需要在编辑数据库时从 Debug 文件夹中运行程序。否则,添加、编辑、删除都会出现错误的数据库文件。我到了这一步,用的是科学戳的方法。
推荐阅读
- python - 如何在 Django 的管理面板中获取请求删除的模型对象列表
- oauth - 无法使用 keycloak SSO 集成 odoo ERP
- python - 对彼此链接的 2 个列表进行排序
- flutter - Flutter 固定底部自定义导航
- google-cloud-platform - GCE 入口健康检查在 kubernetes 上失败
- android - 在尝试检索图像时获取类未找到异常以及无法解码流异常
- ios - 如何在目标 c 中设备旋转后更新 Web 视图宽度?
- c++ - 如何存储具有多个空格的字符串c ++
- java - 警报 Dialog.Builder(??)
- go - 返回 nil 结构而不是空结构 go-gorm