procedure Tfrmdata.DataModuleCreate(Sender: TObject); begin with connectojihua do begin connected:=false; ConnectionString:='; end; if depart_name='铁路医院' then with connectojihua do begin ConnectionString:= 'Provider=SQLOLEDB.1;'+ 'Password=sqlfttlyy;'+ //铁路医院 'Persist Security Info=True;'+ 'User ID=sa;'+ 'Initial Catalog=temp1;'+ 'Data Source=172.25.100.1;'+ //铁路医院 'Connect Timeout=15;'+ 'Use Procedure for Prepare=1;'+ 'Auto Translate=True;'+ 'Packet Size=4096'; end;
if depart_name='电务器材厂' then with connectojihua do begin ConnectionString:= 'Provider=SQLOLEDB.1;'+ 'Password=DMTan;'+ //太原电务器材厂 'Persist Security Info=True;'+ 'User ID=sa;'+ 'Initial Catalog=temp1;'+ 'Data Source=192.168.0.1;'+ //太原电务器材厂 'Connect Timeout=15;'+ 'Use Procedure for Prepare=1;'+ 'Auto Translate=True;'+ 'Packet Size=4096'; end;
if depart_name='某某医院' then with connectojihua do begin ConnectionString:= 'Provider=SQLOLEDB.1;'+ 'Persist Security Info=True;'+ 'User ID=sa;'+ 'Initial Catalog=temp1;'+ 'Data Source=liuhongbao;'+ 'Connect Timeout=15;'+ 'Use Procedure for Prepare=1;'+ 'Auto Translate=True;'+ 'Packet Size=4096'; end;
if depart_name='某某学校' then with connectojihua do begin ConnectionString:= 'Provider=SQLOLEDB.1;'+ 'Persist Security Info=True;'+ 'User ID=sa;'+ 'Initial Catalog=temp1;'+ 'Data Source=dcx;'+ 'Connect Timeout=15;'+ 'Use Procedure for Prepare=1;'+ 'Auto Translate=True;'+ 'Packet Size=4096'; end; connectojihua.Connected:=true;
if application.Title='零件进销存管理' then begin cl_kucuntable.Close; cl_liaokatable.Close; cl_showsp_id.Close; end; if Application.Title = '材料进销存管理' then begin lj_kucuntable.Close; lj_liaokatable.Close; lj_showsp_id.Close; end;
//对数据库进行适当的修改 { with frmdata.query_any do //检查 lj_churuku_sum表是否存在 begin close; sql.clear; sql.Add('select * from lj_churuku_sum '); try open; except with frmdata.lj_Command do begin commandtext:='CREATE TABLE [dbo].[lj_churuku_sum] ( '+ '[sp_id] [varchar] (10) NULL , '+ '[ruku] [float] NULL , '+ '[chuku] [float] NULL , '+ '[rkcs] [int] NULL , '+ '[ckcs] [int] NULL '+ ') ON [PRIMARY] '; execute; end; end;//end of try end; }