S
sayhi
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
filename:string;
inifile:Tinifile;
serverip:string;
serverip1:string;
serverport:string;
picpath:string;
picpath1:string;
gh:string;
begin
if DirectoryExists('//Xdsv/c/pathcs') then
begin
showmessage('ssssssssssssssss');
socketconnection1.Address:='';
socketconnection1.Port:=211;
socketconnection1.ServerName:='';
FileName:=ExtractFilePath(application.ExeName)+'ServerSet.ini';
IniFile:=TIniFile.Create(FileName);
serverip:=inifile.ReadString('KQ','ServerIp','');
serverport:=inifile.ReadString('KQ','ServerPort','');
Label1.Caption:=inifile.ReadString('KQ','Computer','');
picpath:=inifile.ReadString('KQ','picpath','');
Label2.Caption:=serverip;
socketconnection1.Address:=serverip;
socketconnection1.Port:=strtoint(serverport);
socketconnection1.ServerName:='kqserver.kqxunleiserver';
gh:='000381';
socketconnection1.Connected:=true;
end
else
begin
showmessage('bbbbbbbbbbbbbbbb');
// socketconnection1.Close;
socketconnection1.Address:='';
socketconnection1.Port:=211;
socketconnection1.ServerName:='';
FileName:=ExtractFilePath(application.ExeName)+'ServerSet.ini';
IniFile:=TIniFile.Create(FileName);
serverip1:=inifile.ReadString('KQ','ServerIp1','');
serverport:=inifile.ReadString('KQ','ServerPort','');
Label1.Caption:=inifile.ReadString('KQ','Computer','');
picpath1:=inifile.ReadString('KQ','picpath1','');
Label2.Caption:=serverip1;
socketconnection1.Address:=serverip1;
socketconnection1.Port:=strtoint(serverport);
socketconnection1.ServerName:='kqserver.kqxunleiserver';
gh:='000381';
socketconnection1.Connected:=true;
end;
with clientdataset1 do
begin
Close;
RemoteServer:=socketconnection1;
ProviderName:='kq_dsp001';
commandtext:='select * from RS_cxjbxx where gh='+quotedstr(gh)+'';
open;
end;
程序出现第一次连接的是哪台服务器在正常运行的状态下停掉,照理说会进入else语句,这里也确实进入了,但是
socketconnection1.Connected:=true;这句数据库连接还是没有更改掉,仍然是第一次连接的服务器
var
filename:string;
inifile:Tinifile;
serverip:string;
serverip1:string;
serverport:string;
picpath:string;
picpath1:string;
gh:string;
begin
if DirectoryExists('//Xdsv/c/pathcs') then
begin
showmessage('ssssssssssssssss');
socketconnection1.Address:='';
socketconnection1.Port:=211;
socketconnection1.ServerName:='';
FileName:=ExtractFilePath(application.ExeName)+'ServerSet.ini';
IniFile:=TIniFile.Create(FileName);
serverip:=inifile.ReadString('KQ','ServerIp','');
serverport:=inifile.ReadString('KQ','ServerPort','');
Label1.Caption:=inifile.ReadString('KQ','Computer','');
picpath:=inifile.ReadString('KQ','picpath','');
Label2.Caption:=serverip;
socketconnection1.Address:=serverip;
socketconnection1.Port:=strtoint(serverport);
socketconnection1.ServerName:='kqserver.kqxunleiserver';
gh:='000381';
socketconnection1.Connected:=true;
end
else
begin
showmessage('bbbbbbbbbbbbbbbb');
// socketconnection1.Close;
socketconnection1.Address:='';
socketconnection1.Port:=211;
socketconnection1.ServerName:='';
FileName:=ExtractFilePath(application.ExeName)+'ServerSet.ini';
IniFile:=TIniFile.Create(FileName);
serverip1:=inifile.ReadString('KQ','ServerIp1','');
serverport:=inifile.ReadString('KQ','ServerPort','');
Label1.Caption:=inifile.ReadString('KQ','Computer','');
picpath1:=inifile.ReadString('KQ','picpath1','');
Label2.Caption:=serverip1;
socketconnection1.Address:=serverip1;
socketconnection1.Port:=strtoint(serverport);
socketconnection1.ServerName:='kqserver.kqxunleiserver';
gh:='000381';
socketconnection1.Connected:=true;
end;
with clientdataset1 do
begin
Close;
RemoteServer:=socketconnection1;
ProviderName:='kq_dsp001';
commandtext:='select * from RS_cxjbxx where gh='+quotedstr(gh)+'';
open;
end;
程序出现第一次连接的是哪台服务器在正常运行的状态下停掉,照理说会进入else语句,这里也确实进入了,但是
socketconnection1.Connected:=true;这句数据库连接还是没有更改掉,仍然是第一次连接的服务器