在 C#、.Net-2005 中一次读取一条记录来更新多条记录

发布于 2024-09-30 02:26:30 字数 252 浏览 1 评论 0原文

我的要求是从文本文件中读取一行并检查数据库中是否存在记录然后更新它。 从文件中读取一行并获取和更新数据库中的单个记录非常耗时,因为文本文件包含数百万行。 所以这里我们一次只能读取和更新一条记录。

有没有什么方法可以读取记录并更新它并临时存储它(可能就像在数据集或数据表中),我期望解决方案,例如在文件读取完成时更新记录并将其临时存储在某处,然后将记录更新回数据库。

我正在使用 c# 和 .Net 2005。 有没有办法进行这样的记录更新,这将提高更新性能。

My requirement is to read a line from text file and check in database if record exist then update it.
Reading one line from file and fetching and updating a single record in db is much time consumming as text file contains milions of lines.
So here we have to read and update only one record at a time.

Is there any way of reading a record and updating it and storing it temporarely (may be like in dataset or datatable),I am expeactiong solution like to update record and store it somewhere temporarely when file reading complete then will update records back to database.

I am using c# and .Net 2005.
Is there any way to do records updation like this, which will increase updation performanance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

舂唻埖巳落 2024-10-07 02:26:30

将文本文件批量导入到临时表中,然后从临时表对主表执行更新

Bulk-import the text file into a temporary table and then perform the update on the main table from the temporary one

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文