Link to home
Start Free TrialLog in
Avatar of Sebastion
Sebastion

asked on

Delphi - Database Connection

Hey,

This is probably a really basic question, but I'm getting pretty annoyed with the help files and various tutorials on the Internet right now.

What do I need to do to start a Database application?  According to the help, I should have a components palette, but I do not.  I'm familiar with ADO connections (since I used it quite abit in ASP pages), but even example and tutorial that I've seen has assumed that you've already initiated the connection, or that you click on some buttons that do not appear to exist in my version.

I'm using Delphi 7, personal if it makes a difference.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of BlackTigerX
BlackTigerX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BlackTigerX
BlackTigerX

Avatar of Sebastion

ASKER

Damn, that's disappointing.

Thanks anyway though.  I know about the text files already, but this database is going to be quite large, and I don't plan on use text files as the source.
download an example from
page:        http://www.geocities.com/esoftbg/
  link:        Q_21789032.zip                Delphi - Database Connection

The example is about an Access-DataBase connected by ADO components

//................................................................................................

unit Unit1_Q_21789032;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, Buttons, StdCtrls, ExtCtrls,
  DB, DBTables, Grids, DBGrids,DBCtrls, ADODB,
  ComCtrls, ToolWin;

type
  TForm1 = class(TForm)
      dsaLIST: TDataSource;
      gbxInsertEdit: TGroupBox;
      ADOQueryLIST: TADOQuery;
      ToolBar: TToolBar;
      DBNavigator: TDBNavigator;
      ADOConnection: TADOConnection;
      Panel1: TPanel;
      dbgNAMES: TDBGrid;
      DBMemoINFO: TDBMemo;
      DBMemoCOUNTRY: TDBMemo;
      procedure FormCreate(Sender: TObject);
    private{ Private declarations }
    public { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  FN:     TFileName;
  ConnStr:string;
begin
  FN := ExtractFilePath(Application.ExeName) + 'FRIENDS.MDB';
  ConnStr := 'Data Source=' + FN + ';Provider=Microsoft.Jet.OLEDB.4.0';
  if FileExists(FN) then
  begin
    ADOConnection.ConnectionString := ConnStr;
    ADOConnection.Open;
    ADOQueryLIST.Connection := AdoConnection;
    ADOQueryLIST.Active := True;
    ADOQueryLIST.FieldByName('ID').Visible := False;
    ADOQueryLIST.FieldByName('INFO').Visible := False;
    ADOQueryLIST.FieldByName('COUNTRY').Visible := False;
  end;
end;

end.