- Регистрация
- 1 Мар 2015
- Сообщения
- 1,481
- Баллы
- 155
Код:
var s,path: string;
i, j: integer;
AdoQuery: TADOQuery;
begin
cntopt := 0;
minprice := 100000000000;
path := ExtractFilePath(Application.ExeName)+'eat.mdb';
s := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+path+';Persist Security Info=False';
ADOConnection1.ConnectionString := s;
ADOTable1.Close;
ADOTable1.TableName := 'table1';
ADOTable1.Open;
AdoQuery := TADOQuery.Create(nil);
try
AdoQuery.Connection := ADOConnection1;
AdoQuery.SQL.Add('SELECT * FROM table1');
AdoQuery.Open;
i := 1;
fldcount := ADOQuery.FieldCount;
while not AdoQuery.eof do begin
for j := 2 to fldcount do begin
arr[i][j-1] := AdoQuery.Fields[j-1].AsFloat;
end;
names[i] := AdoQuery.Fields[0].AsString;
AdoQuery.Next;
Inc(i);
end;
count := i - 1;
finally
AdoQuery.Free;
end;