procedure TDM.DataModuleCreate(Sender: TObject);
var
PCName, ServerName:
String;
ini:TIniFile;
begin
PCName := GetComputerName;
Servername := form1.cmb_servername.text;
ini:=TIniFile.Create(App_Path + '
settings.ini');
if ini.ReadString('
server','
name','
')<>'
'
then
begin
ServerName:=ini.ReadString('
server','
name','
');
form1.cmb_servername.Text:=ini.ReadString('
server','
name','
');
end;
with ADOConnection1
do
begin
Connected:=false;
ConnectionString:= '
Provider=SQLOLEDB.1;Password=matrox;'+
'
Persist Security Info=True;User ID=sa;'+
'
Initial Catalog=Tennis;'+
'
Data Source='+Servername+'
;'+
'
Use Procedure for Prepare=1;Auto Translate=True;'+
'
Packet Size=4096;Workstation ID='+PCName+'
;'+
'
Use Encryption for Data=False;Tag with column collation when possible=False';
Connected:=true;
end;
if ADOConnection1.Connected
then ShowMessage('
Verbindung zu ' + ServerName + '
hergestellt!')
else
begin
ShowMessage('
Verbindung zu ' + ServerName + '
nicht hergestellt!');
exit;
end;
//die db-controls erhalten ihr datafield
//weather-controls
Form1.ed_temp_min.DataField:='
min_temp';
Form1.ed_temp_max.DataField:='
max_temp';
Form1.ed_wind.DataField:='
wind';
Form1.ed_link_txt.DataField:='
link_txt';
Form1.mem_txt_today.DataField:='
txt_today';
Form1.mem_txt_prognose.DataField:='
txt_prognose';
//help-controls
form1.ed_question.datafield:='
question';
form1.mem_answer.datafield:='
answer';
//player-controls
form1.ed_pl_firstname.datafield:='
first_name';
form1.ed_pl_secondname.datafield:='
second_name';
form1.ed_ioc.datafield:='
ioc';
form1.ed_bdate.datafield:='
birthdate';
form1.ed_bplace.datafield:='
birthplace';
form1.ed_residence.datafield:='
residence';
form1.ed_height.datafield:='
height';
form1.ed_weight.datafield:='
weight';
form1.ed_plays.datafield:='
plays';
form1.ed_profi_since.datafield:='
profi_since';
//matches-controls
form1.ed_m_id.datafield:='
match_id';
form1.ed_pln_a.datafield:='
player_A';
form1.ed_pln_b.datafield:='
player_B';
form1.ed_pla_pts.datafield:='
pts_a';
form1.ed_plb_pts.datafield:='
pts_b';
form1.ed_pla_serv.datafield:='
serv_a';
form1.ed_plb_serv.datafield:='
serv_b';
form1.ed_set1_a.datafield:='
set_1a';
form1.ed_set1_b.datafield:='
set_1b';
form1.ed_set2_a.datafield:='
set_2a';
form1.ed_set2_b.datafield:='
set_2b';
form1.ed_set3_a.datafield:='
set_3a';
form1.ed_set3_b.datafield:='
set_3b';
form1.ed_set4_a.datafield:='
set_4a';
form1.ed_set4_b.datafield:='
set_4b';
form1.ed_set5_a.datafield:='
set_5a';
form1.ed_set5_b.datafield:='
set_5b';
//match-edit-controls
form1.ed_m_id_edt.datafield:='
match_id';
form1.ed_pln_a_edt.datafield:='
player_A';
form1.ed_pln_b_edt.datafield:='
player_B';
form1.ed_pla_pts_edt.datafield:='
pts_a';
form1.ed_plb_pts_edt.datafield:='
pts_b';
form1.ed_pla_serv_edt.datafield:='
serv_a';
form1.ed_plb_serv_edt.datafield:='
serv_b';
form1.ed_set1_a_edt.datafield:='
set_1a';
form1.ed_set1_b_edt.datafield:='
set_1b';
form1.ed_set2_a_edt.datafield:='
set_2a';
form1.ed_set2_b_edt.datafield:='
set_2b';
form1.ed_set3_a_edt.datafield:='
set_3a';
form1.ed_set3_b_edt.datafield:='
set_3b';
form1.ed_set4_a_edt.datafield:='
set_4a';
form1.ed_set4_b_edt.datafield:='
set_4b';
form1.ed_set5_a_edt.datafield:='
set_5a';
form1.ed_set5_b_edt.datafield:='
set_5b';
//die db-anbindungen werden aktiviert
dt_weather.CommandText:='
weather';
dt_weather.Active:=true;
dt_help.CommandText:='
helpdesk';
dt_help.Active:=true;
dt_players.CommandText:='
players';
dt_players.Active:=true;
dt_tournament.CommandText:='
tournaments';
dt_tournament.Active:=true;
dt_matches.CommandText:='
matches';
dt_matches.Active:=true;
dt_match_edit.CommandText:='
matches';
dt_match_edit.Active:=true;
FormatGrids;
ShowMessage('
Anbindung fertig...');
end;