Hi all,
I want to know how, given the name of a field in a table,
verify if it is a foreign key, and obtain the table where it is primary,
the idea behind is to obtain automatically the distinct values automatically in a search module.
'return a list of all fields in a table
Public Function myFields(ByRef table As DataTable) As ArrayList
Dim arr As New ArrayList
For i As Integer = 0 To table.Columns.Count - 1
myFieldsPrimary(table.TableName)
arr.Add(table.Columns(i).ColumnName)
Next
Return arr
End Function
Private Function myFieldsPrimary(ByVal FieldName As String) As ArrayList
'Return
'so basically i get fields of a table from the function myfields,. these are fed in a combobox, and when the user selects one of the field in the combobox, this method should return the values that this field's primary table contains, returns an arraylist to store in my combo2.
End Function