473,511 Members | 16,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

create datatable at runtime

Hi Group,
i'd like to create 10 datatables at runtime
something like this

for (int i=1; i<11;i++)
{
DataTable i.ToString() = new DataTable()
}

How can I do it?

TIA

Peter
Nov 15 '05 #1
2 12315
You can create a dataset:

DataSet ds = new DataSet();

then in the loop:

for (int i = 1; i<11; i++)
{
ds.Tables.Add(i.ToString()); //Not sure of line of code, but should be
something like it.
....
}

Hope this helps.
"LPeter" <no****@nospam.local> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
Hi Group,
i'd like to create 10 datatables at runtime
something like this

for (int i=1; i<11;i++)
{
DataTable i.ToString() = new DataTable()
}

How can I do it?

TIA

Peter

Nov 15 '05 #2
Hi Melih,
your trick works very well

Thank you
Peter

"Melih Odabaþ" <me**********@yahoo.com (no spam)> wrote in message
news:eT***************@tk2msftngp13.phx.gbl...
You can create a dataset:

DataSet ds = new DataSet();

then in the loop:

for (int i = 1; i<11; i++)
{
ds.Tables.Add(i.ToString()); //Not sure of line of code, but should be
something like it.
...
}

Hope this helps.
"LPeter" <no****@nospam.local> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
Hi Group,
i'd like to create 10 datatables at runtime
something like this

for (int i=1; i<11;i++)
{
DataTable i.ToString() = new DataTable()
}

How can I do it?

TIA

Peter


Nov 15 '05 #3

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

Similar topics

4
2088
by: David K | last post by:
we are having a problem when trying to serilalize and deserialize DataTable When replacing the container to be ListArray or HashTable everything works fine The code is very straight forward (...
5
1898
by: Mountain Bikn' Guy | last post by:
How would I do this? public sealed class UtilityClass { public static MyObject Object1;//see note below about importance of static object names in this class public static MyObject Object2;...
0
1834
by: Bill Toulias | last post by:
I want to be able to display the tuples of a select query (which may change at runtime, so no prior knowledge for column characteristics) and edit them as well. I used this code, that executes...
1
1839
by: Bruno Pimentel Machado | last post by:
is it possible (how) to build a asp.net page on the fly? i.e.: I have a db with the controls I want to add to it: 1. TextBox - name "ABC" - Text "CDE" - Left 10 - Top - 30 2. Button - name "BT1" -...
7
2201
by: Dave Taylor | last post by:
I have a DataTable with three string columns, "Value", "Format" and "Type" However, some of the rows contain numbers and dates in the Value field. So I would like to be able to format the output...
11
19685
by: Bruce D | last post by:
I have a DataTable that I need to merge the 'lastname' and 'firstname' fields to be displayed in a datagrid. I know I can use the SQL statement to merge the fields into one, but I want to know if...
10
4927
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
1
1827
by: conckrish | last post by:
Hi all, Can anyone tell me how to find out the memory used by a DataTable at runtime? I am appending lot of data to datatable at runtime.I have to measure this memory comsumption...
5
1546
by: bz | last post by:
Hi, I create a class that retrieves a number of records from database. Internally, the class store the returned data in a datatable / datareader. I would like to bind a listbox to that class (to...
0
7355
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,...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
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,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
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
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
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 ...

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.