Getting Row index from database
Hi everyone,
I got my dataset filled. It is called Dataset1, where there is a table called table1 (now guess the name of a row in that table! :p )
Now I want to change a row of the table in the dataset, which is done this way:
Dataset1.Table1.Rows(3)("Name")="Alfred"
And I'm changing the column 'Name' in row 3 in table1. But normally I don't know the row index. Normally what I know is the value of a certain field, like for example IdTable1. SO i need a function which will give me the row index of the row that contains that idTable1. It has to exists because there are tons of dataset commands that need the row index to operate there has to be a way of obtaining it, something like Dataset1.Table1.Rows(IdTable1=34).GetRowIndex.
Hope somebody knows,
Thanks
Re: Getting Row index from database
to get the row.
take a look at this might helps.
Code:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
For i = 0 To ds.Tables("Table1").Rows.Count - 1
If ds.Tables("Table1").Rows(i)("Firstname").ToString = "Alfred" Then
MessageBox.Show("At row" & i.ToString)
End If
Next
End Sub
:bigyello: