473,394 Members | 1,800 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,394 software developers and data experts.

Adding line number to a dataset

I have a dataset that is being populated from a text file.
example:
OrderNumber,Name,Model,Cost
123,john doe,product1,20.99
123,john doe,product2,10.75

There can be multiple of the same order number. In the dataset, I want to have a column "line number" and I want to put in it the value of the linenumber (in this case 1 and 2) per order. In sql , I was able to accomplish this by inserting rownumber() and grouping by order number. Can this be done in .net?
Thank you.
Mar 16 '10 #1

✓ answered by Frinavale

A DataSet contains one or more DataTable objects.

When you fill a DataSet you are populating the tables within it with data.

I'm not sure what you are trying to do here...but I think what you are looking to do is add a column to the DataTable within the DataSet that has been populated with the information in the text file.

Once you've populated the DataTable, you could try adding a "lineNumber" column to the DataTable using the DataTable.Columns property....

Once you've done that you'll have to loop through all of the Rows in the DataTable and add the line number value to the "lineNumber" column.

-Frinny

1 1806
Frinavale
9,735 Expert Mod 8TB
A DataSet contains one or more DataTable objects.

When you fill a DataSet you are populating the tables within it with data.

I'm not sure what you are trying to do here...but I think what you are looking to do is add a column to the DataTable within the DataSet that has been populated with the information in the text file.

Once you've populated the DataTable, you could try adding a "lineNumber" column to the DataTable using the DataTable.Columns property....

Once you've done that you'll have to loop through all of the Rows in the DataTable and add the line number value to the "lineNumber" column.

-Frinny
Mar 17 '10 #2

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

Similar topics

10
by: Eric Petruzzelli | last post by:
If I fill my dataset and there is no data. The dataset is still created with zero rows (all columns are there). When I add my first row using the script below, it takes over 2 seconds to add??? If...
2
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
3
by: satria | last post by:
hi all, i have a accesslevel table's that has 2 field, id and accesslevelname. i successfully binded the table to datagrid, but i'd like to display a new column, called number. so it 'll display...
10
by: Trevor | last post by:
Hey, I am trying to do this tutorial on the microsoft site : http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dndotnet/html/usingadonet.asp I can get everything to work up to...
9
by: Greg | last post by:
Binding Manager & dataset - won't add record I've got an untyped dataset with controls bound through code. The user can select a question number from a bound combobox, and the question number and...
16
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
10
by: Bernie Yaeger | last post by:
I have a need to add a primary key to a dataset/datatable. How can this be done using a standard oledb data provider? Tx for any help.
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
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: 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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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...

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.