MTSkull
Well-known member
Code:
Dim iCurrentRow As Int32
Dim drDataRow As DataRow
iCurrentRow = grdResult.CurrentRowIndex()
drDataRow = dsDataSet.Tables(PROF_TABLE_NAME).Rows.Find(CInt(iCurrentRow))
giSelectedDoctor = CInt(drDataRow("Professional_ID").ToString)
Exit Sub
1. I search for a doctor and get the results from an SQL Server stored procedure.(in anouther sub)
2. The results are returned to a dataset in anouther procedure and then displayed in a datagrid.(in anouther sub)
3. The user refines the search till he sees the record he wants (hopefully one of only 5 or 6) he then selects that row and clicks a button to use it. The above procedure will capture the "Professional_ID" to be passed into a global, this will be used by the main form to populate various controls from various tables based on this ID.
So I found out which row the user selected and am trying to use that to pull the ID out of the dataset or a Datarow. In the above code I get an error that says it can not find the Primary Key. Since the table has no primary key this strategy is not working. My ado help file says the above method should work.
What I need is either a way to make the above method work or some other strategy to extract the ID from the selected row of the datagrid.
Thanks
Brian