Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Read Access JOIN Metadata
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01438726
Message ID:
01439007
Vues:
28
>Maybe this will help : http://forums.asp.net/t/1378795.aspx
>Snip:
>
>HOWEVER, you cannot get table relationships with GetSchema(). Trying object types like "Relationships" or "ForeignKeys" or "Contraints" just won't work. Do not fret, though; the solution turns out to be very simple!
>Just use GetOleDbSchemaTable() instead of GetSchema(). Here's how:
>string[] restrictions = { null };
>DataTable dt = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Foreign_Keys, restrictions);
>The most interesting columns in the resulting table are called PK_TABLE_NAME, PK_COLUMN_NAME, FK_TABLE_NAME, & FK_COLUMN_NAME.

This returned zero rows.





>
>HTH,
>Viv
>
>>I already tried. I don't see any join info in the result set.
>>
>>
>>
>>>I know nothing about Access but if you call GetSchema() without specifying a collection name you should get *everything* back.
>>>As a last resort poking around in that should give you a clue to the collection you need......
>>>
>>>>I have this code:
>>>>
>>>>
>>>>static void Main(string[] args)
>>>>{
>>>>    // Microsoft Access provider factory
>>>>    DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
>>>>
>>>>    DataTable Info = null;
>>>>
>>>>    using (DbConnection connection = factory.CreateConnection())
>>>>    {
>>>>        // c:\test\test.mdb
>>>>        connection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=K:\KevinM\Apex\APEX Data Warehouse - ProfitKey San Marcos.mdb";
>>>>
>>>>        // We only want user tables, not system tables
>>>>        //string[] restrictions = new string[4];
>>>>        //restrictions[3] = "Columns";
>>>>
>>>>        connection.Open();
>>>>
>>>>        // Get list of user tables
>>>>        //Info = connection.GetSchema("Tables", restrictions);
>>>>        // Info = connection.GetSchema("Tables");
>>>>        Info = connection.GetSchema("Views");
>>>>
>>>>        int Count = Info.Rows.Count;
>>>>    }
>>>>}
>>>>
>>>>
>>>>It returns table and view info for an MS Access database. Anyone know how to get the JOIN info?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform