Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to a sql database

Status
Not open for further replies.

csvideo

Programmer
Oct 19, 2001
74
BB
I am very new to Delphi 6 Enterprise and I would like to know the steps involved in connecting to SQL database? (details)

Now I'm here, I would also like to know how to call a form from within a next form?


thanks
 
chrisman,

Hm. A walkthrough would be kind of hard, at this point, since we don't really have an idea about the database server you're working with or the type of work you want to do with it.

You might consider taking a peek at Part II of the DG.PDF provided on your Delphi 6 Enterprise CD. It's on online version of the "Developer's Guide" and Part II is where much of the database discussion takes place.

As far as calling a form from another form goes, assuming that you've created a form called Form1 and want to open with from Form2:

1. Add Form1's unit name to an appropriate USES block in the unit for Form2.

2. Add to code an appropriate event handler (such as the OnClick event of a button) similar to this:

Code:
procedure TForm2.Button1Click(Sender: TObject);
var
   F : TForm1;
begin

   F := TForm1.create( application );
   try
      if F.showModal = mrOK then
         beep;
   finally
      F.Free;
   end;

end;

Now, this can be shortened to:

Code:
begin

   with TForm1.create( application ) do
   try
      if showModal = mrOK then
         beep;
   finally
      free;
   end;

end;[/code]

Chapter 4 of the "Quick Start" manual demonstrates this and the Using Forms section of the Chapter 6 in the "Developer's Guide" provide all the relevant details. Both books are provided as PDF files on your install CD.

Hope this helps...

-- LAnce
 
I'm use Microsoft SQL Server 2000 what I'm doing is just experimenting with delphi. So I'm creating a simple address book program.

I read at the about.com website there use a DataSource,ADOTable,ADOConnection on the form, whats puzzling to me is how generic is it to set the conectionstring of the ADOConnection in the object inspector. Because from inspection of the conectionstring property I'm seeing very specific infomation. How would this affect when you install the program on a network? Where the database will be on the server and the exe on the clients can anyone shed some light?
 
In a client server enveronment the application will always be on the client. Especially with SQL server which runs on top of NT-server. I do not think that any Network administrator would like the idea the users poking around on the server. Your executable programs will sit on a workstation not on the server.

There is a FAQ on this forum How to use Database Look Up fields faq102-1212, which has some iinformation on DB structures S. van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top