473,473 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Table Row into Colums

111 New Member
I am having a dataset with one table.
I want to copy to another table by making the first row of the table as columnheaders for the new table.

The dataset may be the same of different.

How can I.

Help please.
Dec 11 '07 #1
2 1133
demaus
6 New Member
So you want to create a new data table (dtData2) using the data in the first row of the first table of a dataset (dsDataSet) as the column names for the new data table (dtData2)

Assuming that dsDataSet 's first row of data is something like this
Expand|Select|Wrap|Line Numbers
  1. Col1            Col2         Col3             Col4
  2. Name         Address     Address2     City
  3.  


Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim dsDataSet as DataSet
  3. Dim dtData2 as New DataTable
  4.  
  5. For Each dcCol as DataColumn In dsDataSet.Tables(0).Columns
  6.  
  7. Using dcNew as New DataColumn(dcCol.ColumnName) 'This creates a new column with a name of the columns from the dataset
  8.  
  9. ' Here you can set other things about the column: DataType, Caption, etc...
  10.  
  11. ' then add the column to the new datatable
  12. dtData2.Columns.Add(dcNew)
  13.  
  14. End Using
  15. End Next
  16.  
  17.  
When all is done then dtData2 will have four columns with Column Names of : Name, Address, Address2, City.

hope this is what you wanted or at least helps.
Dec 11 '07 #2
baburk
111 New Member
Thanks for your reply.

It helped me
Dec 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ajay Garg | last post by:
What is the way we could implement a business logic from a Table by storing it statemnnets in a colums and defining an execute sql to execute it.Some legal requirements make it diffcult for us to...
0
by: Bernard Dhooghe | last post by:
In http://www-1.ibm.com/partnerworld/pwhome.nsf/weblook/eac_a_webcast_052504.html the writer says (page 50, Multidimensional Clustering Advisor): " The MDC Advisor feature of the DB2 Design...
3
by: Phil Rutter | last post by:
Hello All, I have about 700 word documents that have 2 tables one is static 4 colums x 5 rows the other is 5 colums x rows ranging from 2 to 100 what i wolud like to do is open the word doc....
1
by: basulasz | last post by:
May be it is a bit easy question but i don't know the way to display data in bounded colums. I get data from DB with a datareader, and I want to display them on bounded colums. I dont want to...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
6
by: Ward Germonpré | last post by:
Hi, I have a reference to a dom table. How can I retrieve the number of columns in that table ? The stop value below doesn't work, nor did my experimenting with tbodies and childNodes.. .......
0
by: ravindarjobs | last post by:
Hello friends, I am using ms access 2003, and Vb6. i am displaying a table in a form as pivot table (following "Auto Form: Pivot Table" Wizard) Usually i select the items i want to be...
1
by: SNN | last post by:
Hi, I am new to Perl and I appreciate if someone can help me. I have a tab delimited file that contains a huge data base( i do not know how many rows I have). The first row is the ID and the...
2
by: Harshpandya | last post by:
Here is my code for look up table - where i am planning to built 10 colums and 8 rows and put array values in the table boxes. Problem is - it is only printing the last array valules instead of all...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
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
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
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...
1
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
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
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
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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.