473,491 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Read value of all columns from datatable together

Hi
Could any one suggest me, is there any way to I get the all column
value from data row together?

For exp

Dim dr as datarow
Dim str as string

For each dr in tbl.datarow

'Here I want all column value of current row in one string type
variable with comma separated without using any loop (
like
Str = all column value of data row

next

Actually I want to convert data table to .csv file without using loop
for columns.
Is it possible?

Thanks

Jun 5 '06 #1
2 4941
If you don't need columnheaders in your CSV and only uses as delimiter the
"," or ";" than it is not needed.

If you want that information than you have to loop through that collection
as you do for erver colletions. What is strange on that. .

Cor

"neeraj" <ne********@gmail.com> schreef in bericht
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi
Could any one suggest me, is there any way to I get the all column
value from data row together?

For exp

Dim dr as datarow
Dim str as string

For each dr in tbl.datarow

'Here I want all column value of current row in one string type
variable with comma separated without using any loop (
like
Str = all column value of data row

next

Actually I want to convert data table to .csv file without using loop
for columns.
Is it possible?

Thanks

Jun 5 '06 #2
If all your columns are of string type, you can do something like:

str = String.Join(", ", CType(r.ItemArray, String()))

If 'r' is your variable for the datarow. In this case the separator is a
comma and a space.

Note, if there are other datatypes involved, this won't work.

But really, I don't see an issue with looping - it's not like it is exactly
a lot of code to write. It's a pretty trivial algorithm.
"neeraj" <ne********@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi
Could any one suggest me, is there any way to I get the all column
value from data row together?

For exp

Dim dr as datarow
Dim str as string

For each dr in tbl.datarow

'Here I want all column value of current row in one string type
variable with comma separated without using any loop (
like
Str = all column value of data row

next

Actually I want to convert data table to .csv file without using loop
for columns.
Is it possible?

Thanks

Jun 5 '06 #3

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

Similar topics

0
1937
by: Enrico Del Grosso | last post by:
Hello everyone, i'm new here and i need a little help from some DataTable experts. I'm using a System.DataTable to fill a Datagrid in a window application, and I need that some rows and columns of...
0
1674
by: rodrigo | last post by:
How to get get the last inserted key (value NOT column) in a specific dataTable dt right after dt.Rows.InsertAt according to code and schema below. The key is a autoincrement column. foreach...
15
4734
by: ruca | last post by:
Hi, Can I read a .TXT File to a DataSet? How can I do that? I want to read his lines to a DropDownList. This lines are the names of employees that I export from an application that I have. I...
2
1911
by: eBob.com | last post by:
I've got the basics of an XML ini file working. I.E. I can stash away and retrieve user preferences. (Code below.) But how do I handle a new preference? Say I have A and B. And then I invent...
10
3692
by: D. Shane Fowlkes | last post by:
I have a function that is called in page_load and the purpose of this function is to look up basic data in a MSSQL table and return it in the form of a datatable. The page_load will read the data...
0
2365
by: den 2005 | last post by:
Hi everybody, I created a Gridview with a TemplateField and there is Label control in ItemTemplate and a DropdownList control in EditItemTemplate, I was to displayed them ok when I click the...
0
3264
by: =?Utf-8?B?bXJjc2hhcnBtYW4=?= | last post by:
Hello, There is a space(as a data) in one of the columns. And i save my DataTable as a xml file using DataSet. I used DataSet.WriteXml method to save as a xml file. Now if I read that .xml file...
4
3497
by: =?Utf-8?B?TWlrZSBE?= | last post by:
I read the CSV file into a DataTable. This is so I can fix invalid dates and other data I don't want in the database. Then I use SqlBulkCopy to insert the data into the SQL database. All the...
1
3340
by: greyseal96 | last post by:
Hi, I am a pretty new programmer, so I apologize in andvance if this is a dumb question... In a book that I'm reading to learn C#, it says that when using a foreach() loop, a read-only copy of...
0
7115
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
6978
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...
0
7154
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
7190
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
6858
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
7360
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
4578
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
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.