TSession控件主要的用途?如何使用?
解决方案 »
- 如何让pagecontrol中的tabsheet没有边框?
- 怎么实现Com+中服务器自动通知客户端(急)
- 动态改变dbgrid 单元格部分字符颜色
- 这就是程序员的下场吗? 今天公司一位30多的程序员惨遭解雇
- 100分,请教几个问题
- 这是什么格式的书?
- 我知道ListView1.Items[1].ImageIndex := 1;可以为LISTVIEW的第一个行...........
- 想问如何直接调用已有的EXCEL的文件,同时当前的程序要最小化。
- SQL语句的一个小问题!
- Delphi 中Application 是什么对象?与TForm有何关系?
- 为什么没有办法像操作EXCEL一样用程序来操作ACCESS,请大家来讨论些问题。来者有分。
- 类的问题
Note: TSession implements the IDBSession interface, which allows the global PasswordDialog function to supply passwords to the component.
procedure TfrmMain.SetSession;
var
MyList: TStringList;
sDir : String;
cFileIni : String;
ClientIni :TIniFile;
str : String;
begin
sDir := ExtractFilePath(Application.ExeName);
cFileIni := sDir+'SystemSetup.ini';
Session1.Active := False;
MyList := TStringList.Create;
ClientIni := TIniFile.Create(cFileIni); //调用的文件名
str := ClientIni.ReadString('FileServer','host',''); //取得字符
try
with MyList do
begin
Add('SERVER NAME='+str);
Add('HOST NAME='+str);
Add('BLOB SIZE=1024');
Add('BLOBS TO CACHE=1024');
Add('USER NAME=tygdsys');
end;
if not Session.IsAlias('TLGDBDE') then
Session1.AddAlias('TLGDBDE', 'mssql', MyList)
else
Session1.ModifyAlias('TLGDBDE',MyList);
Session1.SaveConfigFile;
Session1.Active := True;
finally
MyList.Free;
end;
end;