组合数据表 [英] Combining datatables

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

问题描述

嘿那里,刚刚开始使用数据表,有人能告诉我如何结合2张桌子吗?


我曾尝试过从中填写信息1个表到另一个,其中两个

具有完全相同的表格布局

数据是一个数据表

data1是一个数据表


data.Rows.Add(data1.Rows(0).Item(0))


但是dosnt工作,任何人都可以高高在上我做错了什么?

解决方案

不确定我是否完全理解,但你问你怎么可以

复制一个数据表的内容到另一个?或者你想要两个表合并两个表,创建一个包含两列的新表吗?

如何构建两个表?如有必要,请发布代码。


Bonzol,


使用数据行时必须了解的一件事和数据表

是你永远不能在一个表中有一个数据行。很简单,因为

的事实是数据行有一个属性引用它的表格

在。


但是你可以使用datarow的副本。


但首先回答史蒂文的问题。


Cor


Bonzol < Bo **** @ hotmail.comschreef在bericht

新闻:11 ********************** @ s13g2000cwa.googlegr oups.com ...


嘿那里,刚刚开始使用数据表,谁能告诉我如何组合2个表



我曾尝试将信息从1个表格改为另一个表格,其中两个

具有完全相同的表格布局

数据是数据表

data1是一个数据表


data.Rows.Add(data1.Rows(0).Item(0))


但它有效吗,任何人都可以告诉我我做错了什么?



对不起,对不清楚,


我想将一张桌子的内容复制到另一张桌子


我一直在玩,现在已经尝试了


Dim itemadd As DataRow = data.NewRow()

itemadd = data1.Rows(0).Item(0)

data.Rows.Add (itemadd)


但不起作用。


Hey there, just starting out using data tables, can anyone tell me how
to combine 2 tables?

Ive tried just coyping the info from 1 table to another, which both
have exactly the same table layout
data is a datatable
data1 is a datatable

data.Rows.Add(data1.Rows(0).Item(0))

but it dosnt work, can anyone tall me what im doing wrong?

解决方案

Not sure if I understand completely, but are you asking how you can
copy the CONTENTS of one datatable into another? Or do you want to
MERGE the two tables, creating a new table that has columns from both?
How are both tables constructed previously? Post code if necessary.


Bonzol,

One of the things you have to know when working with datarows and datatables
is that you never can have a datarow in more than one table. Simple because
of the fact that the datarow has a property that references to the table it
is in.

However you can use copies of datarow.

But first answer the question from Steven.

Cor

"Bonzol" <Bo****@hotmail.comschreef in bericht
news:11**********************@s13g2000cwa.googlegr oups.com...

Hey there, just starting out using data tables, can anyone tell me how
to combine 2 tables?

Ive tried just coyping the info from 1 table to another, which both
have exactly the same table layout
data is a datatable
data1 is a datatable

data.Rows.Add(data1.Rows(0).Item(0))

but it dosnt work, can anyone tall me what im doing wrong?



Ahh sorry for not being clear,

I want to copy the contents of one table to another

I have been playing around and have now tried

Dim itemadd As DataRow = data.NewRow()
itemadd = data1.Rows(0).Item(0)
data.Rows.Add(itemadd)

but does not work.


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

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