PC Review


Reply
Thread Tools Rate Thread

Data row question

 
 
Nikolay Petrov
Guest
Posts: n/a
 
      1st Sep 2004
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


 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      1st Sep 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Brad
Guest
Posts: n/a
 
      1st Sep 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Nikolay Petrov
Guest
Posts: n/a
 
      2nd Sep 2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Noob question - binding data to list box (system.data.datarowview?) David Wier Microsoft ASP .NET 0 17th Apr 2008 06:03 PM
Re: Noob question - binding data to list box (system.data.datarowview?) Lloyd Sheen Microsoft ASP .NET 0 17th Apr 2008 05:23 PM
Design question: transferring data between business objects and the data layer olduncleamos Microsoft C# .NET 3 31st Oct 2006 12:29 PM
Data type question for OLEdb data types Brian Henry Microsoft ADO .NET 1 5th Oct 2003 04:18 PM
Data type question for OLEdb data types Brian Henry Microsoft ASP .NET 1 5th Oct 2003 04:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:22 AM.