Click here to Skip to main content
15,907,000 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Get table field size Pin
Eddy Vluggen4-Aug-10 9:52
professionalEddy Vluggen4-Aug-10 9:52 
GeneralRe: Get table field size Pin
cyberexel4-Aug-10 23:13
cyberexel4-Aug-10 23:13 
GeneralRe: Get table field size Pin
Eddy Vluggen5-Aug-10 0:28
professionalEddy Vluggen5-Aug-10 0:28 
QuestionCannot find ContextMenu control in vb.net Pin
Andraw Tang4-Aug-10 6:30
Andraw Tang4-Aug-10 6:30 
AnswerRe: Cannot find ContextMenu control in vb.net Pin
cyberexel4-Aug-10 8:05
cyberexel4-Aug-10 8:05 
GeneralRe: Cannot find ContextMenu control in vb.net Pin
Andraw Tang4-Aug-10 10:25
Andraw Tang4-Aug-10 10:25 
GeneralRe: Cannot find ContextMenu control in vb.net Pin
cyberexel4-Aug-10 23:11
cyberexel4-Aug-10 23:11 
QuestionGet Primary Field and Foreign Fields from Access Table Pin
cyberexel4-Aug-10 4:49
cyberexel4-Aug-10 4:49 
Hi I am trying to get the primary field name and the fields that relate to external tables (foreign fields) when i pass in the name of an access table.

something like this:

Private Sub GetPKFK(ByVal myTable as DataTable)

'code here to tell me the PK field and all FK fields in it
'would be great if I also get the names of tables the table/FK's relate to

End Sub


I am able to do this using Typed DataSets for SQL, ie using some very complicated/combination of SQL statements, which obviously can't work with Access.

I read a lot about DataRow.ChildRelation and DataRow.ParentRelations and get codes like this which return nothing when i pass in tablename ...

Private Sub GetPKFK(ByVal myTable as DataTable)
        Dim myRelation As DataRelation
        Dim arrRows() As DataRow
        Dim myRow As DataRow
        Dim i As Integer
        Dim myColumn As DataColumn

        For Each myRelation In myTable.ChildRelations
            For Each myRow In myTable.Rows
                arrRows = myRow.GetChildRows(myRelation, DataRowVersion.Proposed)
                ' Print values of rows.
                For i = 0 To arrRows.GetUpperBound(0)
                    For Each myColumn In myTable.Columns
                        Console.WriteLine(arrRows(i)(myColumn))
                    Next myColumn
                Next i
            Next myRow
        Next myRelation
End Sub


Thanks for your help
AnswerRe: Get Primary Field and Foreign Fields from Access Table Pin
cyberexel5-Aug-10 6:39
cyberexel5-Aug-10 6:39 
QuestionRemote TCP file Transferring Pin
rezafathi3-Aug-10 14:15
rezafathi3-Aug-10 14:15 
AnswerRe: Remote TCP file Transferring Pin
Garth J Lancaster3-Aug-10 17:25
professionalGarth J Lancaster3-Aug-10 17:25 
Question[VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom3-Aug-10 9:43
The Mighty Atom3-Aug-10 9:43 
AnswerRe: [VB10] Check which ListBox items are selected and which are not Pin
Eddy Vluggen3-Aug-10 10:51
professionalEddy Vluggen3-Aug-10 10:51 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom3-Aug-10 11:53
The Mighty Atom3-Aug-10 11:53 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn3-Aug-10 12:31
sitebuilderLuc Pattyn3-Aug-10 12:31 
GeneralRe: [VB10] Check which ListBox items are selected and which are not [modified] Pin
The Mighty Atom3-Aug-10 13:01
The Mighty Atom3-Aug-10 13:01 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom4-Aug-10 7:14
The Mighty Atom4-Aug-10 7:14 
AnswerRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn4-Aug-10 8:12
sitebuilderLuc Pattyn4-Aug-10 8:12 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom4-Aug-10 8:46
The Mighty Atom4-Aug-10 8:46 
AnswerRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn4-Aug-10 9:25
sitebuilderLuc Pattyn4-Aug-10 9:25 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom4-Aug-10 9:45
The Mighty Atom4-Aug-10 9:45 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn4-Aug-10 11:42
sitebuilderLuc Pattyn4-Aug-10 11:42 
QuestionInput data set changed dynamically according to option selection in VB.net 2005 Pin
Andraw Tang2-Aug-10 12:03
Andraw Tang2-Aug-10 12:03 
AnswerRe: Input data set changed dynamically according to option selection in VB.net 2005 Pin
Eddy Vluggen3-Aug-10 10:55
professionalEddy Vluggen3-Aug-10 10:55 
GeneralRe: Input data set changed dynamically according to option selection in VB.net 2005 Pin
Andraw Tang4-Aug-10 3:49
Andraw Tang4-Aug-10 3:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.