Page 1 of 1

different server name

Posted: Wed 27 Dec 2006 19:24
by biasko
Hello!

I have MyDAC in my project and I would like to read server name for MyConnection from some txt file and than make connect to databese. But I don't know how and when, because my program needs some data from database onShow.
Thanks!

Posted: Thu 28 Dec 2006 12:59
by Antaeus
This may look like the code below:

Code: Select all

procedure TForm1.FormShow(Sender: TObject);
var
  s: string;
begin
  // reading a server name to s
  MyConnection.Server := s;
  MyConnection.Username := 'user';
  MyConnection.Password := 'password';
  MyConnection.Port := 3306;
  MyConnection.Database := 'test';
  MyConnection.Connect;
end;

Posted: Wed 03 Jan 2007 19:51
by biasko
I recieve error (ACESS VIOLATION AT ADRESS 00599303 IN MODEULE 'project.exe'. READ OF ADRESS 000000A0.)

Thanks for help!

Posted: Wed 03 Jan 2007 19:54
by biasko
oh..I found out.. i must put this code ONSHOW