将数据集表转换为数组列表 [英] dataset table into an array list

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

问题描述

如何将指定的数据集表放入数组列表?


Hrcko

How to put a specified dataset table into an array list ?

Hrcko

推荐答案

arrayList .Add(" myArrayList",dSet.Tables [" MyTable"]);

" Hrvoje Voda" < HR ********* @ luatech.com>在消息中写道

news:d7 ********** @ ss405.t-com.hr ...
arrayList.Add("myArrayList", dSet.Tables["MyTable"]);
"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d7**********@ss405.t-com.hr...
如何放置指定的数据集表进入数组列表?

Hrcko
How to put a specified dataset table into an array list ?

Hrcko



我设法填充数组,但我不知道如何获得一个真实的信息

来自该数组。


当我尝试用该数组中的项目填充列表时,我得到:

System.Collections.ArrayList,

而不是实际数据。


这是代码:


ArrayList arrayList = new ArrayList();

arrayList.Add(db.dataSetUsers.Functions);


list.Items.Add(arrayList);


Hrcko

" Adam Barker" <亚当@ NO ****** @ q-state.co.NO_SPAM.uk>在消息中写道

news:%2 *************** @ TK2MSFTNGP12.phx.gbl ...
I managed to fill an array, but I don''t konw how to get a real informations
from that array.

When I try to fill a list with items from that array, I get:
System.Collections.ArrayList,
and not the actual data.

This is the code:

ArrayList arrayList = new ArrayList();
arrayList.Add (db.dataSetUsers.Functions);

list.Items.Add(arrayList);

Hrcko
"Adam Barker" <adam@NO******@q-state.co.NO_SPAM.uk> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
arrayList.Add (myArrayList,dSet.Tables [" MyTable"]);

" Hrvoje Voda" < HR ********* @ luatech.com>在消息中写道
新闻:d7 ********** @ ss405.t-com.hr ...
arrayList.Add("myArrayList", dSet.Tables["MyTable"]);
"Hrvoje Voda" <hr*********@luatech.com> wrote in message
news:d7**********@ss405.t-com.hr...
如何将指定的数据集表放入数组列表?

Hrcko
How to put a specified dataset table into an array list ?

Hrcko




" Hrvoje Voda"写了......
"Hrvoje Voda" wrote...
我设法填充了一个数组,但我不知道如何从该数组获得真实的信息。


当你使用数组这个词时,这有点令人困惑。当你的意思是

ArrayList(和vv)...

当我尝试用该数组中的项目填充列表时,我得到:系统。 Collections.ArrayList,而不是实际数据。


那是因为你没有填写带有实际项目的列表,但是带有

的ArrayList实例。


(我猜你真的不是指 list",但是ListBox ...)

list.Items.Add(arrayList);


我甚至不确定你是否已经获得了ArrayList的内容,因为我猜你已经填充了。它带有某种物品的集合,而不是物品

自己?

arrayList.Add(db.dataSetUsers.Functions);
I managed to fill an array, but I don''t konw how to get
a real informations from that array.
It''s a bit confusing when you''re using the word "array" when you mean an
ArrayList (and v.v.)...
When I try to fill a list with items from that array,
I get: System.Collections.ArrayList, and not the actual data.
That is because you didn''t "fill" the list with the actual items, but with
the ArrayList instance.

(I''m guessing that you really don''t mean a "list", but a ListBox...)
list.Items.Add(arrayList);
I''m not even sure you''ve got the contents of the ArrayList right, as I guess
you "filled" it with some kind of collection of items, and not the items
themselves?
arrayList.Add (db.dataSetUsers.Functions);




那么,属性db.dataSetUsers.Functions是什么呢?实际上回来了?


如果它是一些实现接口ICollection的集合,我想你

而不想使用AddRange:


arrayList.AddRange(db.dataSetUsers.Functions);


....并且类似地将ArrayList的* contents *放入

ListBox:


list.Items.AddRange(arrayList.ToArray());


甚至还有您可以使用ArrayList跳过

的中间步骤,具体取决于您对它的其他用途,以及

种类的集合" db.dataSetUsers .Functions"是。


这样的事情应该是可能的:


list.Items.Add(db.dataSetUsers.Functions.ToArray());


....但正如我所说,这取决于函数

属性的集合类型......

// Bjorn A



So, what does the property "db.dataSetUsers.Functions" actually return?

If it''s some collection implementing the interface ICollection, I guess you
rather want to use AddRange instead:

arrayList.AddRange (db.dataSetUsers.Functions);

....and similarily when you put the *contents* of the ArrayList into the
ListBox:

list.Items.AddRange( arrayList.ToArray() );

There''s even a possibility that you could skip the intermediate step of
using the ArrayList, depending on what other use you have for it, and what
kind of collection "db.dataSetUsers.Functions" is.

Something like this should be possible:

list.Items.Add( db.dataSetUsers.Functions.ToArray() );

....but as I said, that''s depending on which type of collection the Functions
property really is...
// Bjorn A


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

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