Форум: "Базы";
Текущий архив: 2005.11.27;
Скачать: [xml.tar.bz2];
ВнизМожно ли узнать количество таблиц у SQL сервера Найти похожие ветки
← →
__Пупкин (2005-10-16 11:00) [0]Т.е. надо прочитать структуры БД: получить имена всех таблиц а в таблица все поля.
← →
isasa © (2005-10-16 11:17) [1]Если использовать ADO.
Соединиться, юзаемfunction EditConnectionString(Component: TComponent): Boolean;
из$Delphi$\Source\Property Editors -> AdoConEd.pas
var SourceConnection: TADOConnection;
tNameBo: TComboBox;
...
if EditConnectionString(SourceConnection) then begin
tNameBox.Items.Clear;
SourceConnection.GetTableNames(tNameBox.Items, false);
...
Поля можно вывести в TListView
procedure TConnForm.FillFieldList;
var mF : TListItem;
i : integer;
begin
FieldList.Clear;
for i:=0 to testTable.FieldCount-1 do begin
mF:=FieldList.Items.Add;
mF.Caption:=testTable.Fields[i].FieldName;
mF.SubItems.Add(DataTypeStr(testTable.Fields[i].DataType));
mF.SubItems.Add(IntToStr(testTable.Fields[i].DataSize));
end;
end;
function TConnForm.DataTypeStr(fType : TFieldType) : string;
begin
case fType of
ftUnknown: Result:="Unknown or undetermined";
ftString: Result:="Character or string field";
ftSmallint: Result:="16-bit integer field";
ftInteger: Result:="32-bit integer field";
ftWord: Result:="16-bit unsigned integer field";
ftBoolean: Result:="Boolean field";
ftFloat: Result:="Floating-point numeric field";
ftCurrency: Result:="Money field";
ftBCD: Result:="Binary-Coded Decimal field that can be converted to Currency type without a loss of precision.";
ftDate: Result:="Date field";
ftTime: Result:="Time field";
ftDateTime: Result:="Date and time field ";
ftBytes: Result:="Fixed number of bytes (binary storage)";
ftVarBytes: Result:="Variable number of bytes (binary storage)";
ftAutoInc: Result:="Auto-incrementing 32-bit integer counter field";
ftBlob: Result:="Binary Large OBject field";
ftMemo: Result:="Text memo field";
ftGraphic: Result:="Bitmap field";
ftFmtMemo: Result:="Formatted text memo field";
ftParadoxOle: Result:="Paradox OLE field";
ftDBaseOle: Result:="dBASE OLE field";
ftTypedBinary: Result:="Typed binary field";
ftCursor: Result:="Output cursor from an Oracle stored procedure (TParam only)";
ftFixedChar: Result:="Fixed character field";
ftWideString: Result:="Wide string field";
ftLargeint: Result:="Large integer field";
ftADT: Result:="Abstract Data Type field";
ftArray: Result:="Array field";
ftReference: Result:="REF field";
ftDataSet: Result:="DataSet field";
ftOraBlob: Result:="BLOB fields in Oracle 8 tables";
ftOraClob: Result:="CLOB fields in Oracle 8 tables";
ftVariant: Result:="Data of unknown or undetermined type";
ftInterface: Result:="References to interfaces (IUnknown)";
ftIDispatch: Result:="References to IDispatch interfaces";
ftGuid: Result:="globally unique identifier (GUID) values";
ftTimeStamp: Result:="Date and time field accessed through dbExpress";
ftFMTBcd: Result:="Binary-Coded Decimal field that is too large for ftBCD.";
else
result:="???";
end;
end;
← →
__Пупкин (2005-10-16 11:28) [2]Спасибо. Ты мне помог.
Страницы: 1 вся ветка
Форум: "Базы";
Текущий архив: 2005.11.27;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.011 c