Posted by Ruby on September 05, 2010
In Reply to ADO posted by Mary Streetland on September 02, 2010
: How do I make the right connection? Can I do it with just a TADOTable? What do I need to fill in for connectionstring? I just want a simple connection, no passwords of other kind of things.Duplicated your code and compiled it with Delphi 2007, this worked for an Access database.
var Capacity: integer; begin TruckTable.Active := False; TruckTable.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;' + 'Data Source=' + ExtractFilePath(Application.ExeName) + 'Trucks.mdb;' + 'Persist Security Info=False'; TruckTable.Active := True ; TruckTable.First; Capacity := 0; while not TruckTable.Eof do begin Capacity := Capacity + TruckTable.FieldByName('Capacity').AsInteger; TruckTable.Next; end; Label1.Caption := IntToStr(Capacity); TruckTable.Close; end;
Good luck!
Ruby
Related articles
Follow Ups