Mohammad Hamdan Posted July 25, 2013 Share 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 Link to comment Share on other sites More sharing options...
rencarnacion Posted July 25, 2013 Share 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; Link to comment Share on other sites More sharing options...
Mohammad Hamdan Posted July 25, 2013 Author Share Posted July 25, 2013 thank you Ronny EncarnacionI will search about the UDL Files Link to comment Share on other sites More sharing options...
rencarnacion Posted July 25, 2013 Share 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 Link to comment Share on other sites More sharing options...
adragan Posted July 29, 2013 Share 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 Link to comment Share on other sites More sharing options...
Mohammad Hamdan Posted September 4, 2013 Author Share Posted September 4, 2013 thank you adragan Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now