使用C#组合多个Access表 [英] Combining multiple Access tables using C#

查看:86
本文介绍了使用C#组合多个Access表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我遇到了一些问题。我想要做的是通过组合其他已经存在的表来创建一个新的Access表。

例如,让我们考虑Table1(带有列A,B和C),Table2(具有列A,D和E)和表3(具有列A,F和G),其中表1.A =表2.A =表3.A。从这些开始,我想创建一个新表TableResult,其中包含A,B,C,D,E,F和G列,其中包含所有数据。有一个问题:除了A列之外,我希望代码能够获取其他列的名称。

我想过使用Union,但我需要实际创建一个新的结合前面的表格。


任何想法?


提前致谢!

Hello everyone,

I''m having a bit of trouble with something. What I''m trying to do is create a new Access table by combining other already existing Tables.
For instance, let''s consider Table1 (with columns A, B and C), Table2 (with columns A, D and E) and Table3 (with columns A, F and G), where Table1.A = Table2.A = Table3.A. From these, I want to create a new table TableResult, with columns A, B, C, D, E, F and G, with all the data contained in them. There''s one catch: I want the code to get the names of the other columns, apart from column A.
I''ve thought about using Union, but I need to actually create a new table by combining the previous tables.

Any ideas?

Thanks in advance!

推荐答案

使用连接。但是你应该只在表格与1相关时才这样做。否则你最终会复制信息并最终得到非规范化数据。
Use a join. But you should only do this if the tables are related 1 to 1. Otherwise you''re going to end up duplicating information and end up with denormalized data.


@Rabbit - 你能给出吗?我举例说明如何使用Join?另外,我忘了在原帖上添加内容。我只是编辑它并添加了这个:有一个问题:我希望代码获取除A列之外的其他列的名称。
@Rabbit - Can you give me an example as how to do it using Join? Also, I forgot to add something to the original post. I just edited it and added this: "There''s one catch: I want the code to get the names of the other columns, apart from column A."


SQL加入表的代码是
The SQL code to join a table is
展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


这篇关于使用C#组合多个Access表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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