QmD valeu pela resposta mais tenho outra perg?
tem como tirar as consultas listar so as tabelas ?
Anonymous
Curtidas 0
Respostas
Qmd
07/03/2003
sim eh possivel...
pegando emprestado a rotina no source do adodb e fazer algumas:
procedure TForm1.GetTableNamesEX(Conexao : TADOConnection; List: TStrings);
var
TypeField,
NameField: TField;
TableType: string;
DataSet: TADODataSet;
begin
DataSet := TADODataSet.Create(nil);
try
Conexao.OpenSchema(siTables, EmptyParam, EmptyParam, DataSet);
TypeField := DataSet.FieldByName(´TABLE_TYPE´); { do not localize }
NameField := DataSet.FieldByName(´TABLE_NAME´); { do not localize }
List.BeginUpdate;
try
List.Clear;
while not DataSet.EOF do
begin
TableType := TypeField.AsString;
if (TableType = ´TABLE´) then { do not localize }
List.Add(NameField.AsString);
DataSet.Next;
end;
finally
List.EndUpdate;
end;
finally
DataSet.Free;
end;
end;
============================================
dae a chamada do procedimento:
GetTableNamesEX(adoconnection1, listbox1.items);
falow
pegando emprestado a rotina no source do adodb e fazer algumas:
procedure TForm1.GetTableNamesEX(Conexao : TADOConnection; List: TStrings);
var
TypeField,
NameField: TField;
TableType: string;
DataSet: TADODataSet;
begin
DataSet := TADODataSet.Create(nil);
try
Conexao.OpenSchema(siTables, EmptyParam, EmptyParam, DataSet);
TypeField := DataSet.FieldByName(´TABLE_TYPE´); { do not localize }
NameField := DataSet.FieldByName(´TABLE_NAME´); { do not localize }
List.BeginUpdate;
try
List.Clear;
while not DataSet.EOF do
begin
TableType := TypeField.AsString;
if (TableType = ´TABLE´) then { do not localize }
List.Add(NameField.AsString);
DataSet.Next;
end;
finally
List.EndUpdate;
end;
finally
DataSet.Free;
end;
end;
============================================
dae a chamada do procedimento:
GetTableNamesEX(adoconnection1, listbox1.items);
falow
GOSTEI 0