简体   繁体   English

通过VB.net用数据填充.mdb文件

[英]Filling a .mdb-File with Data through VB.net

i'm using oledb and DataSets on VB.net for filling an access database (.mdb). 我正在VB.net上使用oledb和DataSet填充访问数据库(.mdb)。 It works in the following process: 它的工作过程如下:

  • i have an existing .mdb-file with Data in it 我有一个带数据的现有.mdb文件
  • creating an oledb-dataadapter to the existing .mdb-file 为现有的.mdb文件创建一个oledb-dataadapter
  • filling a DataSet/DataTAble with the Data from the file (adapter.fill()) 用文件中的数据填充DataSet / DataTAble(adapter.fill())
  • adding a new row to the dataset 向数据集添加新行
  • filling the row with data 用数据填充行
  • updating the dataset/datatable through the dataadapter to the .mdb file 通过dataadapter将数据集/数据表更新为.mdb文件

This works so long, the problem is: I'm doing this process a few thousand times, with a few thousand datasets. 这工作了这么长时间,问题是:我正在使用数千个数据集执行此过程数千次。 From time to time, this is during longer and longer. 有时,这会越来越长。 I think it's because the dataadapter has to go through the whole database all the time and because i'm taking the whole dataset from the database all the time out, and updating it back to the database. 我认为这是因为dataadapter必须一直遍历整个数据库,并且因为我一直都在从数据库中提取整个数据集,然后将其更新回数据库。

So my question: is there an oppurtunity to do this in an other way? 所以我的问题是:是否有其他方法可以做到这一点? Without taking the whole data out from the database and taking it back? 是否没有从数据库中取出全部数据并将其取回? And without going through the whole Databse? 并且没有经历整个数据库? Maybe with a sql-connection and then just adding a row to the end of the database?? 也许使用sql连接,然后仅在数据库末尾添加一行?

Thanks for your help! 谢谢你的帮助!

If You only adding rows - why not use SqlOleDBCommand ? 如果仅添加行-为什么不使用SqlOleDBCommand He has method .ExecuteScalar() 他有方法.ExecuteScalar()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM