procedure TForm1.N19Click(Sender: TObject);
var
s:String;
begin
if OpenDialog1.Execute then
s := OpenDialog1.FileName;
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+'Data Sourse='+ s;
ADOConnection1.Connected := true;
ADODataSet1.Recordset := ADOConnection1.Execute('SELECT * FROM CUSTOMER');
end;
Помогите с Access
У меня код такой
Код:
Но выдаёт ошибку "Опеоация недоступна пока обект открыт"
и выделяет строку "ADOConnection1.Connected := true;"
В чем пречина.
Код:
procedure TForm1.N19Click(Sender: TObject);
var
s:String;
begin
if OpenDialog1.Execute then begin
s := OpenDialog1.FileName;
if ADOConnection1.Connected then ADOConnection1.Close;
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+'Data Sourse='+ s;
ADOConnection1.Open;
ADODataSet1.Recordset := ADOConnection1.Execute('SELECT * FROM CUSTOMER');
end;
end;
var
s:String;
begin
if OpenDialog1.Execute then begin
s := OpenDialog1.FileName;
if ADOConnection1.Connected then ADOConnection1.Close;
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+'Data Sourse='+ s;
ADOConnection1.Open;
ADODataSet1.Recordset := ADOConnection1.Execute('SELECT * FROM CUSTOMER');
end;
end;