Are are using latest uniDac universal components.
For ms access tuniConnection function GetTableNames is returning system table names like MSysNavPaneGroupCategories,MSysNavPaneGroups,MSysNavPaneGroupToObjects..etc
Here is sample code.
uniConnectio1.ProviderName := 'ACCESS';
uniConnectio1.LoginPrompt := false;
uniConnectio1.Database := opendialog.filename;
uniConnectio1.Connected := true;
if uniConnectio1.connected then
uniConnectio1.GetTableNames( StringList1,False );
Please help.
Thanks.
GetTableNames returning system table for Access
Re: GetTableNames returning system table for Access
Hello,
The AllTables parameter in the GetTableNames makes difference for those databases, in which different schemes are supported within one DB. To retrieve only user tables, you can use the TuniMetaData component.
P.S. As Restrictions parameters, you can also specify TABLE, SYSTEM TABLE, VIEW, to retrieve corresponding objects.
The AllTables parameter in the GetTableNames makes difference for those databases, in which different schemes are supported within one DB. To retrieve only user tables, you can use the TuniMetaData component.
Code: Select all
program Project11;
{$APPTYPE CONSOLE}
uses
SysUtils, Uni, AccessUniProvider;
var
UniConnection: TUniConnection;
UniMetaData: TUniMetaData;
begin
UniConnection := TUniConnection.Create(nil);
try
UniConnection.ConnectString := 'LoginPrompt=False;ProviderName=Access;Data Source=d:\BD.accdb';
UniConnection.Connect;
UniMetaData := TUniMetaData.Create(nil);
try
UniMetaData.Connection := UniConnection;
UniMetaData.MetaDataKind := 'Tables';
UniMetaData.Restrictions.Values['TABLE_TYPE'] := 'SYSTEM TABLE';
UniMetaData.Open;
while not UniMetaData.Eof do begin
WriteLn(UniMetaData.FieldByName('TABLE_NAME').AsString);
UniMetaData.Next;
end;
finally
UniMetaData.Free;
end;
finally
UniConnection.Free;
readLn;
end;
end.
Re: GetTableNames returning system table for Access
Alex,
I did used AllTables as false in GetTableNames . And I am still getting this issue.
uniConnectio1.GetTableNames( StringList1,False );
Are you suggesting we don't use as above and instead use TuniMetaData ?
Thanks
I did used AllTables as false in GetTableNames . And I am still getting this issue.
uniConnectio1.GetTableNames( StringList1,False );
Are you suggesting we don't use as above and instead use TuniMetaData ?
Thanks
Re: GetTableNames returning system table for Access
Alex,
This worked for me.
UniMetaData.Restrictions.Add('TABLE_TYPE=TABLE');
Still wondering why this did not worked
uniConnectio1.GetTableNames( StringList1,False );
Thanks.
This worked for me.
UniMetaData.Restrictions.Add('TABLE_TYPE=TABLE');
Still wondering why this did not worked
uniConnectio1.GetTableNames( StringList1,False );
Thanks.
Re: GetTableNames returning system table for Access
As I wrote you earlier, the AllTables parameter makes sense for those databases only, in which schemes exist, in MS Access this parameter is ignored. To retrieve database objects, you should use the UniMetaData component, as it is shown in the previous sample.
Re: GetTableNames returning system table for Access
Thanks Alex for further clarification. That definitely makes sense.
Thank You.
Thank You.