[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2146
  • Last Modified:

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.
0
Sebastion
Asked:
Sebastion
  • 2
1 Solution
 
BlackTigerXCommented:
I don't think the personal version comes with any database components, you would have to look for third party components to access databases
0
 
SebastionAuthor Commented:
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.
0
 
esoftbgCommented:
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now