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

Data row question

How to find a row number in a datatable?

I know how to iterate through rows in table using:

dim row as system.data.datarow
for each row in DataSet1.tables(table_index).rows
'statemens
next

But i want to find the row number which my statement currenlty is working
on.

TIA
Nov 21 '05 #1
3 2176
There is no way to find the index of a give datarow, other then going
through the datatable looking for it.

You can also add a column to keep track of the row's index, but that means
keeping it up to date during inserts, etc.

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
How to find a row number in a datatable?

I know how to iterate through rows in table using:

dim row as system.data.datarow
for each row in DataSet1.tables(table_index).rows
'statemens
next

But i want to find the row number which my statement currenlty is working
on.

TIA

Nov 21 '05 #2
You can also use an iteration in the For Each loop or use
me.bindingcontext(theDataSet, "The Table").position. Keep in mind that this
is 0 based so you would need to add 1.

Hope this helps.
"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
How to find a row number in a datatable?

I know how to iterate through rows in table using:

dim row as system.data.datarow
for each row in DataSet1.tables(table_index).rows
'statemens
next

But i want to find the row number which my statement currenlty is working
on.

TIA

Nov 21 '05 #3
Can I use this somehow to find row number or something similiar
Dim tbl As System.Data.DataTable
Dim i As Integer
Dim j As Integer
For i = 0 To tbl.Rows.Count - 1
If (tbl.Rows(i).Item(0)) = "something" Then
j = i
End If
Next

"Brad" <ba******@ukcdogs.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
You can also use an iteration in the For Each loop or use
me.bindingcontext(theDataSet, "The Table").position. Keep in mind that this is 0 based so you would need to add 1.

Hope this helps.
"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
How to find a row number in a datatable?

I know how to iterate through rows in table using:

dim row as system.data.datarow
for each row in DataSet1.tables(table_index).rows
'statemens
next

But i want to find the row number which my statement currenlty is working on.

TIA


Nov 21 '05 #4

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

Similar topics

0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
1
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but...
5
by: Rick | last post by:
The data adapter wizard allows you to add more than one table, but that doesn't seem to work right when setting up a dataset. Some of the documentation I have read states that only one table...
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
11
by: E.T. Grey | last post by:
Hi, I have an interesting problem. I have a (LARGE) set of historical data that I want to keep on a central server, as several separate files. I want a client process to be able to request the...
5
by: AAJ | last post by:
Hi all FIRST THE BORING BITS....... I normally use a Database layer, a Business layer and a GUI layer. The GUI uses an Object data source to bind to the Business layer which in turn binds...
20
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an...
1
by: cypher_key | last post by:
I want to write a simple application for my own use. I've already have the data populated in a database and I have a data source setup. I can use the wizards to generate a master detail data form...
1
by: student2008 | last post by:
Sorry about the title its a tricky one. I have a form which allows me to add a question and answers into a mysql database via a combination of, if a certain option is chosen and the reset button...
0
by: saijin | last post by:
I'm planning to call a list of data from an XML file but when I duplicate the content inside the <data></data> it is not showing anything Here's the ActionScript 3.0 import...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.