473,549 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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.sele ct?)

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

Thanks,

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

dim myDataView as new dataview(mytabl e)

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.sele ct?)

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**@smartybir d.com> wrote in message
news:%2******** *******@tk2msft ngp13.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.sele ct?)

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.Selec t returns an array of rows,
allowing you to use DataRow.Delete to delete the row from the DataTable
itself, Also DataTable.Selec t 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**@smartybir d.com> wrote in message
news:%2******** *******@tk2msft ngp13.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.sele ct?)

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
5125
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 what point when learning C++ was I supposed to have picked up STL? I ask because at every job I've had, and every job interview for that matter,...
19
3282
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 IE so I drew conclusions only to discover that it worked even with <a name="xtop"></a> but not in Opera. IE6 understands "top" to mean *the...
6
7039
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 does not.
16
4427
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
2922
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 markup hall of shame, ;-)
2
2207
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 setting that tell the process that the new top of the document region is now at the end of the last block-container used, this must be set in that last...
2
17171
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
24943
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
1626
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
0
7541
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...
0
7464
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...
0
7979
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...
1
7497
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...
0
6065
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5385
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...
0
5107
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...
1
1960
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
781
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.