Results 1 to 2 of 2

Thread: Getting Row index from database

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    70

    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! )

    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

  2. #2
    Hyperactive Member fret's Avatar
    Join Date
    Sep 2004
    Posts
    472

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width