473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Runtime Array and DataTable with VB.NET

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"
mDov(2) = "ABC_03"
mDov(3) = "ABC_04"
mDov(4) = "ABC_05"

Now I need to create 5 Public type DataTable and the each table name based
on the above strings.

How to I create in runtime 5 DataTable (in future might be more) as:

Public Shared tbl_ABC_01 as DataTable
Public Shared tbl_ABC_02 as DataTable
Public Shared tbl_ABC_03 as DataTable
Public Shared tbl_ABC_04 as DataTable
Public Shared tbl_ABC_05 as DataTable

As you can see the Table name came from above array.

I also need to crate runtime string array and each array name based on the
above strings. But I don't know how?

I appricate your kind help and reading my post.

Thank you.

Rgds,
Niyazi
Jul 19 '06 #1
2 2002
Hi Niyazi,

If you don't know how many tables and their names at design time, then you
cann not code it the way you want. You could have an array of datatables,
with a number of items that is determinded at runtime. For example :

declaration like this:
Public shared tblABC() as datatable

dimensios assigned like this, after mDov is retrieved from your database:
ReDim tblABC(mDov.GetLength(0)-1)

Hope this helps,

Joris

"Niyazi" wrote:
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"
mDov(2) = "ABC_03"
mDov(3) = "ABC_04"
mDov(4) = "ABC_05"

Now I need to create 5 Public type DataTable and the each table name based
on the above strings.

How to I create in runtime 5 DataTable (in future might be more) as:

Public Shared tbl_ABC_01 as DataTable
Public Shared tbl_ABC_02 as DataTable
Public Shared tbl_ABC_03 as DataTable
Public Shared tbl_ABC_04 as DataTable
Public Shared tbl_ABC_05 as DataTable

As you can see the Table name came from above array.

I also need to crate runtime string array and each array name based on the
above strings. But I don't know how?

I appricate your kind help and reading my post.

Thank you.

Rgds,
Niyazi

Jul 19 '06 #2
Hi Joris,

Sorry for my late post. I had some busy schedule with family. I thank you
for your kind help an yes it did the job that I was looking for.

Thank you.

Rgds,
GC

"Joris Zwaenepoel" wrote:
Hi Niyazi,

If you don't know how many tables and their names at design time, then you
cann not code it the way you want. You could have an array of datatables,
with a number of items that is determinded at runtime. For example :

declaration like this:
Public shared tblABC() as datatable

dimensios assigned like this, after mDov is retrieved from your database:
ReDim tblABC(mDov.GetLength(0)-1)

Hope this helps,

Joris

"Niyazi" wrote:
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"
mDov(2) = "ABC_03"
mDov(3) = "ABC_04"
mDov(4) = "ABC_05"

Now I need to create 5 Public type DataTable and the each table name based
on the above strings.

How to I create in runtime 5 DataTable (in future might be more) as:

Public Shared tbl_ABC_01 as DataTable
Public Shared tbl_ABC_02 as DataTable
Public Shared tbl_ABC_03 as DataTable
Public Shared tbl_ABC_04 as DataTable
Public Shared tbl_ABC_05 as DataTable

As you can see the Table name came from above array.

I also need to crate runtime string array and each array name based on the
above strings. But I don't know how?

I appricate your kind help and reading my post.

Thank you.

Rgds,
Niyazi
Jul 24 '06 #3

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

Similar topics

5
by: jon morgan | last post by:
Hi, I am trying to clean out all the VB specific code in a project before porting to C#. Having removed all the import references I still see the VB runtime is loaded at startup. How can I pin...
0
by: Chankama | last post by:
Hi. I am making an application using the Compact Framework for a PPC. Essentially what I am trying to do is, read a table from a external datasource, and try to display it using the datagrid. For...
5
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;...
4
by: Haydnw | last post by:
Hi, I'd like to put a load of database results (several rows for 5 fields) into a two-dimensional array. Now, this may be a really stupid question, but can someone give me a pointer for how to...
5
by: Gary Blakely | last post by:
I'm giving this post another try - it can't be too difficult for everyone.... In the program below, the web page has dataGrid1. the only thing that has been done to it at design time is to...
9
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...
5
by: Geoff Jones | last post by:
Hi Suppose we have an array of DataRows e.g. Dim drMyRows() As DataRow = myTable.Rows(0).GetChildRows("PricesCompany") generated via a relationship. The question I have is this. Isn't...
6
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...
2
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.