473,890 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
+ 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 4976
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********@gma il.com> schreef in bericht
news:11******** **************@ i39g2000cwa.goo glegroups.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.ItemArr ay, 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********@gma il.com> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.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
1974
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 the datatable get merged together(the same effect as rowspan and colspan in HTML). Is there anyone who can help me? I'm really in trouble. Cheers Enrico
0
1707
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 (MyContainer item in al) {
15
4765
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 export them to a .txt file and I want to "work" with this employees in my aspx page. Can you help me? It's a little bit strange, but it's what I need. :)
2
1934
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 C. The first time the new version with C is run the XML file will not have a value for C. How do I detect that case? Somewhere I got the impression that I could use IsNull, but I was unable to find an example which I could apply to my code. My...
10
3725
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 and then fill a few simple labels. **Assuming** that I wrote the function properly, how exactly can I write the page_load sub to read the data from the function? I've tried a few examples from a couple of books I have but can't seem to get a...
0
2404
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 Edit Command button. But when I about to get the value of this template field I get an empty string value. I check the following the local dtFiles has data and the cells are visible at stage right before foreach GridViewRow gr in gdvFiles.Rows) loop....
0
3283
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 using DataSet.ReadXml method,it removes space in that DataTable. Any idea...? This does not work in Visual Studio .NET 2003. If I execute this in VS .Net 2005, it works. I must make it work in VS 2003.
4
3518
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 rows are being read and inserted into the table. The problem is that one of the columns in the CSV contains the value of 1 thru 6 or C, BUT only the numbers seem to be read into the DataTable not the letter. I tried single quotes and double quotes...
1
3371
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 the iteration variable is used and you cannot modify it. For example: int pins = {9, 3, 7, 2} int newPin = 10; foreach(int pin in pins) {
0
9979
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9825
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11234
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10828
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10925
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
8018
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7171
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5854
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6052
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.