473,503 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataTable from Array

Hi All,

I have a need to create a generic DataTable using data in a 2D array of
strings (I do not have direct access to the database, and am given the data
via another program that I do not have control over).

Is there a quicker, more efficient way to do it besides creating an empty
DataTable and creating and appending DataRows?

Thanks,
pagates
Nov 17 '05 #1
4 10443
pagates,

Not really, but it would be easy to create a function that takes the
array, the columns you want each element in the array to be populated with,
and then create the data table. You could then reuse this over and over.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
Hi All,

I have a need to create a generic DataTable using data in a 2D array of
strings (I do not have direct access to the database, and am given the
data
via another program that I do not have control over).

Is there a quicker, more efficient way to do it besides creating an empty
DataTable and creating and appending DataRows?

Thanks,
pagates

Nov 17 '05 #2
I suppose the same theory would be true for a DataAdapter...

Thanks,
pagates

"Nicholas Paldino [.NET/C# MVP]" wrote:
pagates,

Not really, but it would be easy to create a function that takes the
array, the columns you want each element in the array to be populated with,
and then create the data table. You could then reuse this over and over.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
Hi All,

I have a need to create a generic DataTable using data in a 2D array of
strings (I do not have direct access to the database, and am given the
data
via another program that I do not have control over).

Is there a quicker, more efficient way to do it besides creating an empty
DataTable and creating and appending DataRows?

Thanks,
pagates


Nov 17 '05 #3
Do you mean creating a data adapter which wraps around a two-dimensional
array? I don't know that it would, because a data adapter would require
commands to query/update/insert/delete records.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
I suppose the same theory would be true for a DataAdapter...

Thanks,
pagates

"Nicholas Paldino [.NET/C# MVP]" wrote:
pagates,

Not really, but it would be easy to create a function that takes the
array, the columns you want each element in the array to be populated
with,
and then create the data table. You could then reuse this over and over.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
> Hi All,
>
> I have a need to create a generic DataTable using data in a 2D array of
> strings (I do not have direct access to the database, and am given the
> data
> via another program that I do not have control over).
>
> Is there a quicker, more efficient way to do it besides creating an
> empty
> DataTable and creating and appending DataRows?
>
> Thanks,
> pagates


Nov 17 '05 #4
Hi Nicholas,

I was just "thinking out loud."

I am adapting a project that currently uses Odbc-based stuff
(OdbcDataReader, OdbcDataAdapter, etc.) to be able to instead use the data
returned in a 2-D string array instead. A lot less elegant, and we won't
know column names, etc. (at least, without doing some "magic" with queries).

Basically, its a new project based upon old technology. I used the Odbc
classes to "get it working" (the stuff that relies on the data) and now need
to backfill with the old stuff to get the actual data.

Thanks,
Paul
"Nicholas Paldino [.NET/C# MVP]" wrote:
Do you mean creating a data adapter which wraps around a two-dimensional
array? I don't know that it would, because a data adapter would require
commands to query/update/insert/delete records.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
I suppose the same theory would be true for a DataAdapter...

Thanks,
pagates

"Nicholas Paldino [.NET/C# MVP]" wrote:
pagates,

Not really, but it would be easy to create a function that takes the
array, the columns you want each element in the array to be populated
with,
and then create the data table. You could then reuse this over and over.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
> Hi All,
>
> I have a need to create a generic DataTable using data in a 2D array of
> strings (I do not have direct access to the database, and am given the
> data
> via another program that I do not have control over).
>
> Is there a quicker, more efficient way to do it besides creating an
> empty
> DataTable and creating and appending DataRows?
>
> Thanks,
> pagates


Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1741
by: Mountain Bikn' Guy | last post by:
When one gets a row from a database (ie, a DataTable), the row contains a typed value in each column. How is this typically implemented behind scenes. I want to build this functionality myself. The...
2
3161
by: Fredrik Rodin | last post by:
All, I've been looking around for a solution to my problem for a couple of days now. In short, here's my situation: 1. I'm getting a result from a component back as a datatable and I have...
0
3126
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
9
17693
by: Rui Sampainho | last post by:
Hi Is there any command to transfer the contents of a datatable to an array. What I'm looking for is sort of a bulk process, not an iteration with a loop based on a field by field or row by row...
3
5380
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
2
2010
by: Niyazi | last post by:
Hi everyone, I have 5 string in my array that I get from MS Access DB. Public mDov(0) as string and I fill with my for loop. The result as shown below mDov(0) = "ABC_01" mDov(1) = "ABC_02"...
1
5709
by: Maxwell2006 | last post by:
Hi, I am working with strongly typed datatables. What is the most efficient way to build a new DataTAble based on the result of DataTable.Select? At this point I use a foreach loop to do the...
6
2340
by: Paulers | last post by:
Hello, I have a string that I am trying to add each char to a datatable row. for example if I have a string that looks like "abcdefg", I would like to break it up into an array of characters...
0
2174
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
11
4613
by: John Dann | last post by:
Is there a concise/efficient way to retrieve blocks of rows from a datatable with VB2005? I've got a datatable (let's call it AllData), constructed programmatically, that contains a lot of...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.