Create Relation in Access.MDB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

How do I create a relation between a Master Table and its Child Table in
Access.MDB using ADO.NET.
Ex: I need to create a relationship between InvoiceNo from tblInvoice to
InvoiceNo from tblInvoiceDetail.
I need to create a Foreign Key that link CustomerID from tblInvoice to
CustomerID from tblCustomer

Anyone help?

Thank You,
mfwoo
 
Hi,

You would need to use COM-based ADOX to do this. ADO.NET does not support
it.
 
¤ Hi,
¤
¤ How do I create a relation between a Master Table and its Child Table in
¤ Access.MDB using ADO.NET.
¤ Ex: I need to create a relationship between InvoiceNo from tblInvoice to
¤ InvoiceNo from tblInvoiceDetail.
¤ I need to create a Foreign Key that link CustomerID from tblInvoice to
¤ CustomerID from tblCustomer
¤

ADOX, as Val mentioned, is one way to do it. However, I would recommend Jet SQL DDL instead to avoid
having to use COM interop:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acintsql.asp


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top