I am trying to create relationships for a lot of linked, mysql tables, via vb.net using ADOx.net, I am using the following code (modified just to work on two tables):
Code:
Now if I run the above code on the related tables I get the error message:
"An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Access_Creator.exe
Additional Information: Unspecified Error"
Creating the relationships manually I receive no error, creates a one to many relationship.
If I save the same tables to the Access database and run the code, the code works fine and creates the relationships, creates a one to many relationship with enfored referntial integrity.
I am assuming that the linked tables won't allow relationships to be made with enforced referntial integrity, from doing a search when using linked tables integrity is maintained at source anyway, so my question is how to create the relationships withoput enforcing referential integrity or is the error from something else that I am missing?
regards,
Matt
Code:
VB.NET:
dim cat as adox.catalog
dim tbl as adox.table
dim fk as adox.key
dim cn as adodb.connection
dim dir_nme as string = "c:\db\"
dim mdb_name as string = "test.mdb"
cn.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dir_name & mdb_name)
cat.activeconnection = cn
tbl = cat.tables("Orders")
fk.name = "fk1"
fk.type = keytypeenum.adkeyforeign
fk.relatedtable = "Customers"
fk.columns.append("Customers_PKEY")
fk.columns("Customers_PKEY").related column = "PKEY"
fk.type = keytypeEnum.adkeyforeign
tbl.keys.append(fk)
"An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Access_Creator.exe
Additional Information: Unspecified Error"
Creating the relationships manually I receive no error, creates a one to many relationship.
If I save the same tables to the Access database and run the code, the code works fine and creates the relationships, creates a one to many relationship with enfored referntial integrity.
I am assuming that the linked tables won't allow relationships to be made with enforced referntial integrity, from doing a search when using linked tables integrity is maintained at source anyway, so my question is how to create the relationships withoput enforcing referential integrity or is the error from something else that I am missing?
regards,
Matt