Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
An ADO replacement for SQL Explorer Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
19-Aug-03
Category
DB-General
Language
Delphi 5.x
Views
134
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Massimo Brini 

Most programmers use the SQL Explorer which is installed by default with Delphi. 
With the announced extinction of the BDE, an alternative is needed for everyday’s 
common tasks. This is my solution. 

How do I query an Access MDB File with ADO (no BDE installed)?

Answer:

The SQL Explorer has been for years one of the most important tools I used. 
Now that I decided to shift from BDE solutions to ADO, I needed an alternative for 
the SQL Explorer which could gave me at least the same functionalities, so I 
created this little Delphi project (which I called ADO Explorer) which gaves me the 
main features a real programmer needs. In the next weeks I will prepare a second 
article in which I will explain how to customize and empower this program, makin it 
even a better solution that the Old, original, beloved SQL Explorer. 

1. Open your Delphi 5 and create a new blank project. 

2. On the form, drop these components: 

An ADOConnection 
An ADOQuery 
A DBGrid 
A DataSource 
3 Buttons 
A Memo component 
An Edit component 
An OpenDialog and SaveDialog component 

3. Connect together the DB components (ADOConnection->ADOQuery->DataSource->DBGrid) 

4. Insert in the first button’s OnClick Event handler this code: 

1   procedure TForm1.Button1Click(Sender: TObject);
2   begin
3     if ADOQuery1.Active then
4       ADOQuery1.Close;
5     if ADOConnection1.Connected then
6       ADOConnection1.Connected := False;
7     ADOConnection1.ConnectionString := Edit1.Text;
8     ADOQuery1.SQL := Memo1.Lines;
9     if UpperCase(Copy(Memo1.Lines[0], 1, 6)) = 'SELECT' then
10    begin
11      ADOQuery1.Open; // Result Set attended fro mthe operation
12    end
13    else
14    begin
15      ADOQuery1.ExecSQL; // No result set -> different method to open
16    end;
17  end;


5. Insert in the second button’s OnClick Event handler this code: 

if OpenDialog1.Execute then
  Memo1.Lines.LoadFromFile(OpenDialog1.FileName);

6. Insert in the third button’s OnClick Event handler this code: 

if SaveDialog1.Execute then
  Memo1.Lines.SaveToFile(SaveDialog1.FileName);

7. Build & compile the project: the new ADO SQL Explorer is done! 

The program can archive the most important queries used; it recognizes on its own 
the correct method to use with the given query and can be used against virtually 
every kind of OleDB or ODBC supported database. 

The Sources of the program will be made available for download soon on my website (http://www.dreamscape.it) or can be asked directly by email to massimo.brini@dreamscape.it. 

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC