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

"top" of datatable (newby)

Hi:

I have created a datatable and I'm able to access it by key values.

I need to be able to go to the "top" of the datatable and process
records sequentially until they are completed.

I can't figure out the command to set me to the top or "beginning" and
then read. (datatable.select?)

Any help in the steps to do this would be greatly appreciated!

Thanks,

Fred
Nov 20 '05 #1
3 1694
I solved it - it was too easy:

dim myDataView as new dataview(mytable)

Thanks!
Fred Nelson wrote:
Hi:

I have created a datatable and I'm able to access it by key values.

I need to be able to go to the "top" of the datatable and process
records sequentially until they are completed.

I can't figure out the command to set me to the top or "beginning" and
then read. (datatable.select?)

Any help in the steps to do this would be greatly appreciated!

Thanks,

Fred

Nov 20 '05 #2
Fred,

Dataviews are good if you want to create a temporary filter. You still have
to create a loop to read through the file. Just to read the file from start
to finish most people use the following:

Dim dr As DataRow
For Each dr in MyTable
... Do something using "dr." to reference each field
Next

Regards
"Fred Nelson" <fr**@smartybird.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi:

I have created a datatable and I'm able to access it by key values.

I need to be able to go to the "top" of the datatable and process
records sequentially until they are completed.

I can't figure out the command to set me to the top or "beginning" and
then read. (datatable.select?)

Any help in the steps to do this would be greatly appreciated!

Thanks,

Fred

Nov 20 '05 #3
Fred,
In addition to the other examples you can use:

Dim table As DataTable

For Each row As DataRow in table.Rows
' do something with the row
Next

For Each row As DataRow in table.Select()
' do something with the row
Next

Dim view As New DataView(table)
For Each row As DataRowView in view
' do something with the row
Next

Each is useful in their own right. Most of the time I use the first.
DataTable & DataView allow you to filter rows. The second is useful if you
want to delete selected rows, as DataTable.Select returns an array of rows,
allowing you to use DataRow.Delete to delete the row from the DataTable
itself, Also DataTable.Select is overloaded so you can sort & filter the
returned rows. The DataView has some very flexible sorting, searching, and
filtering abilities, plus you can bind to it.

I recommend David Sceppa's book "Microsoft ADO.NET - Core Reference" from MS
Press. As it is a good tutorial on ADO.NET as well as a good desk reference
once you know ADO.NET.

Hope this helps
Jay

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi:

I have created a datatable and I'm able to access it by key values.

I need to be able to go to the "top" of the datatable and process
records sequentially until they are completed.

I can't figure out the command to set me to the top or "beginning" and
then read. (datatable.select?)

Any help in the steps to do this would be greatly appreciated!

Thanks,

Fred

Nov 20 '05 #4

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

Similar topics

87
by: ziliath | last post by:
I recently tried out the Google "top coder" contest, as a C++ coder. I noticed immediately that they expected me to know STL. To which I say, what the fuck?! I may be missing something, but at...
19
by: Mason A. Clark | last post by:
How was I to know that "top" means "top" in MSIE6 ?? I was testing <a name="top"></a> at the top of the page with <a href="#top>go to top</a> at the bottom of the page. It always worked in...
6
by: Mason A. Clark | last post by:
LAST WORD(s): 1. MSIE6 and Firefox will go to the top of the page on command <a href="#top">go upsy</a> even if there is NO name="top" or id="top" They know what a "top" is :-) Opera...
16
by: Gufus | last post by:
Hi Group... <a name="#top"></a> ----del---- ----del---- <img SRC="images/top.gif" USEMAP="#top" BORDER=0> <map NAME="top">
16
by: J. C. Denton | last post by:
I just manually validated alexa's global top 100 sites and find only 2 sites that pass validation. They are http://www.microsoft.com/ http://www.wikipedia.org/ All others should go w3c...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
2
by: Derrick | last post by:
or is there some other MaxRows type of prop so you can limit result set? Thanks in advance! Derrick
9
by: jensen bredal | last post by:
I have a dataView and i only want to get the first x rows . Is there a way of doing this without using Foreach? Thanks JB
3
by: snoonan | last post by:
The company in quesiton does construction work. Tables look like this: ***Job Table*** JobNumberID* JobName ***JobNote Table*** JobNoteID* JobNumberID* JobNoteCreateDate
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...

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.