By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,221 Members | 1,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,221 IT Pros & Developers. It's quick & easy.

Move Array To Table

P: n/a
VS 2003 .NET 1.1

What is the fastest way to move 2 dimensional Array of objects into a
DataTable, besides using a loop?
I have a about 30,000 elements in my array and I have to move it into a
DataTable

Thank You

Peter
Jun 28 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Peter,
Basically you need to keep doing DataTable.NewRow, so I don't think there is
an alternative. e.g. (pseudocode):

DataRow row;
foreach(item in myArray)
{
row=MyTable.NewRow();
row.ItemArray= item // assuming they match the columns, or whatever
MyTable.Rows.Add(row);
}

--Peter

}
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Peter" wrote:
VS 2003 .NET 1.1

What is the fastest way to move 2 dimensional Array of objects into a
DataTable, besides using a loop?
I have a about 30,000 elements in my array and I have to move it into a
DataTable

Thank You

Peter

Jun 28 '06 #2

P: n/a
Hi Peter,

Thanks for your post!

I agree with pbromberg that .Net FCL does not provide interface to import 2
dimensional array into DataTable. You have to loop through the Array to add
them row by row.

Yes, I see that there are a lot of elements in the array, so the importing
may have some impact on the performance. I think you'd better use certain
type of delay import in the design to reduce the performance impact. For
example, you seldom display all the elements in the GUI, so you may paging
all the elements in several sections, and import and display one section at
a time.

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 29 '06 #3

P: n/a
Hi Peter,

Does reply make sense to you? Do you still have any concern regarding it?
Please feel free to tell me, thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 3 '06 #4

P: n/a

""Jeffrey Tan[MSFT]"" <je***@online.microsoft.comwrote in message
news:Ek**************@TK2MSFTNGXA01.phx.gbl...
Hi Peter,

Does reply make sense to you? Do you still have any concern regarding it?
Please feel free to tell me, thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

I have found a solution at
http://www.codeproject.com/cs/databa...dArrayGrid.asp where you can move
2 dimensional array to DataGrid, unfortunately I can not figure out how to
change the GridColumnStyle so I can format individual cells. I have asked
the author "How do I apply column styles to a DataGrid that uses
ArrayDataView instead of DataSet", but he does not respond.

Even though I am displaying only 10 by 20 grid (10 rows by 20 columns) I
have to give the user an ability to scroll to any part of the table very
fast and this table might contain up to 7,000 columns so I can not put this
into Access Table.
Thank you
Peter
Jul 3 '06 #5

P: n/a
Hi Peter,

Have you tried my sample project? Does it meet your need? Please feel free
to tell me, thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 7 '06 #6

P: n/a

""Jeffrey Tan[MSFT]"" <je***@online.microsoft.comwrote in message
news:aR**************@TK2MSFTNGXA01.phx.gbl...
Hi Peter,

Have you tried my sample project? Does it meet your need? Please feel free
to tell me, thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
What sample project are you referring to?
Jul 12 '06 #7

P: n/a
Hi Peter,

I have added a reply to you in Tue, 04 Jul 2006. I performed some search in
google and found that it is missed in groups.google.com, so I suspect it is
missed in the newsgroup, however, I still can see it in our internal suppor
tool. Anyway, I will paste that reply here:

"Hi Peter,

Thanks for your feedback!

DataGrid does not support formatting for individual cells, it can only
apply formatting at column level with DataGridTextBoxColumn.Format and
FormatInfo properties.

To customize ArrayDataView for supporting DataGridTextBoxColumn, I have
provided you some guide line in the link below:
http://groups.google.com/group/micro...es.csharp/msg/
363eb3e9931a4041?hl=zh-CN&

To demonstrate my statement, I have modified that project regarding the
guide I provided. In the sample project, I set
DataGridTextBoxColumn.Format="c", so that all the cells will display
currency style of value.

I have attached my modified sample project in this reply. You can download
it with Outlook Express, not IE.

I am not sure I understand your second completely. Why do you mention
"Access Table"? I did not suggest you put the data in "Access Table". What
I was suggestion is that: since your data is huge, if you are binding all
the data with DataGrid, the initial databinding and displaying time will be
significant long, which gives the end user a not good experience on your
application. So it is better to introduce certain type of paging in
databinding. That is divide all your data into several sections, and only
bind 1 section of data with DataGrid, and provide another "Next Page"
button for the user, which will load next section of data and bind with the
DataGrid for displaying. This will improve the performance and GUI
significantly.

Anyway, if you have good reason to not use paging, you can remain the
current design.

Hope this helps!"

Regarding the sample project, you may send an email to me, I will send you
that project. You may contact me at: je***@online.microsoft.com(remove
"online.")

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 13 '06 #8

P: n/a
Hi Peter,

Have you reviewed my last reply? Does it make sense to you? If you want,
please feel free to email me, I will send you the sample project. Thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 17 '06 #9

P: n/a

""Jeffrey Tan[MSFT]"" <je***@online.microsoft.comwrote in message
news:yf**************@TK2MSFTNGXA01.phx.gbl...
Hi Peter,

Have you reviewed my last reply? Does it make sense to you? If you want,
please feel free to email me, I will send you the sample project. Thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
What sample project are you referring to? (I don't see one)
Jul 17 '06 #10

P: n/a
Hi Peter,

Thanks for your feedback!

I have sent an email to you with the attachment. Please check it in your
mailbox and feedback any comment here. Thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 18 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.