使用新表的内容更新空表 [英] Updating an empty table with contents of a new table

查看:60
本文介绍了使用新表的内容更新空表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,这是我的问题:

我有一个由表格创建的多条记录的datagridview.当datagridview完成更新后,我将创建数据的数据集,并
将其保存到临时表中.通常大约5或6行.

我想从临时表中获取数据,并将其放入数据库中的第二个表中.这将是数据库中的永久表.

我尝试将数据集复制到新数据集,但无法弄清楚如何更新第二个数据集.

我试图从第一个数据集创建一个arraylist来填充第二个数据集,但也没有运气.无法弄清楚如何更新多于一行的表.

创建永久性表后,我将清空临时表.

我知道这应该是一个简单的解决方案,但是在尝试了多种可能性之后,我似乎找不到答案.所有帮助将不胜感激.

Tom

OK, here''s my problem:

I have a datagridview with multiple records created by a form. When the datagridview has finished being updated I create a dataset of the data and
save it to a temporary table. Usually about 5 or six rows.

I want to take the data from the temporary table and put them into a second table in my database. This would be a permanent table in the database.

I''ve tried copying the dataset to a new dataset but could not figure out how to update the second dataset.

I''ve tried to create an arraylist from the first dataset to populate the second dataset but no luck either. Could not figure out how to update the table with more than one row.

I would empty the temporary table after creating the permanent one.

I know this should be a simple solution, but I cannot seem to find the answer after trying numerous possibilities. All help would be appreciated.

Tom

推荐答案

您需要直接在数据库表中输入数据,而不是使用临时数据集.
触发嵌入式"INSERT"查询.为此,您需要先创建一个SQL连接.
在网上搜索如何从VB.NET代码创建SQL连接,然后执行Fire和嵌入式查询,这将把要插入的所有值插入数据库表.
You need to enter the data in database table directly instead using the temporary dataset.
Fire an embedded "INSERT" QUERY. For this you nedd to create a SQL Connection first.
Search on net how to create SQL Connection from your VB.NET code and then Fire and embedded query which will insert all values you want to insert into Database Table.


这篇关于使用新表的内容更新空表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆