Mohammad Hamdan Posted July 25, 2013 Posted July 25, 2013 In Web Mode, can i read from INI file? i use the following code. var INI : TIniFile; strINIFilePath : String; strReadedVal : string; begin Result := False; Try strINIFilePath := GetCurrentDir + 'Config.ini'; strReadedVal := EmptyStr; If FileExists(strINIFilePath) Then Begin Ini := TIniFile.Create(strINIFilePath); Try strReadedVal := Ini.ReadString(strSec,strTag, '0'); strVal := strReadedVal; Result := True; Finally FreeAndNil(Ini); End; End; except Result := False; End; this work in normal VCL Application, but not work in ISAPI DLL , I want to use the INI file to Store the SQL Server Connection String and other Values Quote
rencarnacion Posted July 25, 2013 Posted July 25, 2013 Why don't you use UDL files ? Is easy to use than INI files Example : dbConecta.Close; dbconecta.ConnectionString := 'FILE NAME=' + UniServerModule.StartPath + '\Files\dbConecta.udl'; dbconecta.Open; Quote
Mohammad Hamdan Posted July 25, 2013 Author Posted July 25, 2013 thank you Ronny EncarnacionI will search about the UDL Files Quote
rencarnacion Posted July 25, 2013 Posted July 25, 2013 It easy to work to udl files, you just only has to create a txt file and change the extension txt by udl. Example : myDbConnect.txt by myDbConecct.udl, Then you just only has to click and you will see the option to connect to any database Ronny Encarnacion 1 Quote
adragan Posted July 29, 2013 Posted July 29, 2013 In case you want to stick to the ini files : function ReadSetup:boolean; var fname:string; ini:TIniFile; begin fname:=UniServerModule.StartPath+'etc\your_conf_file.ini'; if FileExists(fname) then begin Conn.Connected := False; ini:=TIniFile.Create(fname); try ..... Read the stuff you want here result:=True; finally ini.Free; end; end else begin UniServerModule.Logger.AddLog('No conf file ->'+fname); result:=False; end; end; 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.