合并数据集/表或添加列 [英] Merging datasets/tables or adding columns
问题描述
大家好,
我有两个数据库.一个是SQL数据库,另一个是Access数据库.
在Access数据库中,我有一个包含三列EMPID,FIRSTNAME和LASTNAME的表.
我在VB程序中将此加载到名为"EMPID_Table"的表中.
在SQL数据库中,有一个表,其中包含很多我需要检索的数据
基于Employee#,与Access数据库中的EMPID相同.在我的
将VB程序加载到名为"WagesTable"的表中
如何合并这些表,或将FIRSTNAME和LASTNAME列添加到WagesTable
到我的VB程序中正确的Employee#?我根本无法更改SQL数据库,
只能从中读取.
Hi All,
I have two databases. One is an SQL database and the other is an Access database.
In the Access database, I have a table with three columns EMPID, FIRSTNAME and LASTNAME.
I load this in my VB program to a table called "EMPID_Table"
In the SQL database, there is a table that has a lot of data that I need to retrieve
based on the Employee#, which is the same as the EMPID from the Access database. In my
VB program this is loaded into a table called "WagesTable"
How can I merge these tables, or add the columns FIRSTNAME and LASTNAME to the WagesTable
to the correct Employee# in my VB program? I cannot change the SQL database at all, I
can only read from it.
访问查询:
Dim EMPID_Query As String = _
"SELECT *" & "FROM [EMPID_Table]"
'This returns EMPID, FIRSTNAME and LASTNAME
'I fill this to a table called "EMPID_Table"
推荐答案
如果要从SQL Server中的Access导入 ,可以尝试,但要花一些时间.
If it is for importing from Access in SQL server, than don't try it, it is possible but takes a bunch of time.
然后使用SQLBulkcopy
Use then SQLBulkcopy
http://msdn.microsoft.com/en-us/library /system.data.sqlclient.sqlbulkcopy.aspx
这篇关于合并数据集/表或添加列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!