1. The LOCAL SHARE setting needs to be set to TRUE.
2. The NET DIR needs to be set to a particular Drive/directory.
3. I may (in some cases) need to add an alias with a path setting.
How can I do these things from within our Delphi 3/5 application?
Thanks,
-= Jesse =-
http://www.msdlg.com
http://www.davinci-mims.com
>I can change BDE configuration in BDE Administrator. How can I change these
>settings in my program. (for example: Net Dir attribute at
>Configuration\Drivers\Native\Paradox
>or
>Local Share attribute at Configuration\System\Init)
>Best Regards...
>Faruk KAYNAKLI
>fkay...@yahoo.com
>fk1...@bbm.com.tr
> SetConfigValue('\DRIVERS\NATIVE\PARADOX\', 'NET DIR', 'c:\');
>It should be:
>SetConfigValue('\DRIVERS\PARADOX', 'NET DIR', 'c:\');
>Gert
>See the examples for DbiOpenCfgInfoList at
>www.borland.com/devsupport/bde/bdeapiex.
--
>Bill
>Bill Todd (TeamB)
>(TeamB cannot respond to questions received via email)
On Wed, 19 Jan 2000 10:13:35 +0200, "Faruk KAYNAKLI"
<fkay...@yahoo.com> wrote:
>I can change BDE configuration in BDE Administrator. How can I change these
>settings in my program. (for example: Net Dir attribute at
>Configuration\Drivers\Native\Paradox
>or
>Local Share attribute at Configuration\System\Init)
Here is an example for Local Share:
procedure SetLocalShare;
const
InitPath = '\System\Init';
LocalShareDesc = 'LOCAL SHARE';
LocalShareValue = 'TRUE';
var
Cursor: HDbiCur;
ConfigDesc: CfgDesc;
begin
Check(DbiInit(nil));
Check(DbiOpenCfgInfoList(nil, dbiReadWrite, cfgPersistent,
InitPath, Cursor));
try
while DbiGetNextRecord(Cursor, dbiNoLock, @ConfigDesc, nil) =
0 do
begin
if StrIComp(ConfigDesc.szNodeName, LocalShareDesc) = 0 then
begin
if StrIComp(ConfigDesc.szValue, LocalShareValue) <>
0 then
begin
Check(DbiGetRecord(Cursor, dbiWriteLock,
@ConfigDesc, nil));
StrPCopy(ConfigDesc.szValue, LocalShareValue);
Check(DbiModifyRecord(Cursor, @ConfigDesc, True));
end;
end;
end;
finally
DbiCloseCursor(Cursor);
DbiExit;
end;
end;
Note: this will only take effect after you restart your application
*and* after all BDE-using applications are closed.
Net Dir is similar, but can also be set for your application only via
TSession (which is the preferred way, IMHO).
HTH,
Jan
That work fine with your example
SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
I try it with
SetConfigValue('\DRIVERS\NATIVE\PARADOX\', 'NET DIR', 'c:\');
and the error $2208 occurs. Why? Can anybody help me????
I need to change the Net Dir Parameter.
Andreas
Gert Kello wrote:
> > I can change BDE configuration in BDE Administrator. How can I change
> these
> > settings in my program. (for example: Net Dir attribute at
> > Configuration\Drivers\Native\Paradox
> > or
> > Local Share attribute at Configuration\System\Init)
> For changing config params You may use following code:
>
> <<<begin>>>
> procedure SetConfigValue(sNode, sItem, sValue: string);
> var
> hCur: hDBICur;
> Config: CFGDesc;
> rslt: DBIResult;
> temp: array[0..255] of char;
> begin
> file://Open the idapi.cfg and read details for the node given
> Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT,
> StrPCopy(temp, sNode), hCur));
> try
> file://Go to the top of the node.
> Check(DbiSetToBegin(hCur));
> file://Go thru each leaf in the node until we come to the required
item.
> repeat
> file://Don't use check here. We neet the result
> rslt := DbiGetNextRecord(hCur, dbiNOLOCK, @Config, nil);
> if (rslt = DBIERR_NONE) then begin
> if StrPas(Config.szNodeName) = sItem then begin
> file://Modify the record.
> StrPCopy(Config.szValue, sValue);
> Check(DbiModifyRecord(hCur, @Config, True));
> Break;
> end;
> end
> else file://There was an error
> if (rslt <> DBIERR_EOF) then
> Check(rslt);
> until (rslt <> DBIERR_NONE);
> finally
> file://Close the Cursor
> if (hCur <> nil) then
> Check(DbiCloseCursor(hCur));
> end;
> end;
> <<<end>>>
>
> and setting Local Share with it:
> <<<<begin>>>>
> Check(dbiInit(nil));
> try
> // ********* SET THE LOCAL SHARE PROPERTY TO TRUE *********
> SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
> finally
> Check(dbiExit);
> end;
> <<<<end>>>>
>
> Gert
> I can change BDE configuration in BDE Administrator. How can I change
these
> settings in my program. (for example: Net Dir attribute at
> Configuration\Drivers\Native\Paradox
> or
> Local Share attribute at Configuration\System\Init)
For changing config params You may use following code:
<<<begin>>>
procedure SetConfigValue(sNode, sItem, sValue: string);
var
hCur: hDBICur;
Config: CFGDesc;
rslt: DBIResult;
temp: array[0..255] of char;
begin
file://Open the idapi.cfg and read details for the node given
Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT,
StrPCopy(temp, sNode), hCur));
try
file://Go to the top of the node.
Check(DbiSetToBegin(hCur));
file://Go thru each leaf in the node until we come to the required
item.
repeat
file://Don't use check here. We neet the result
rslt := DbiGetNextRecord(hCur, dbiNOLOCK, @Config, nil);
if (rslt = DBIERR_NONE) then begin
if StrPas(Config.szNodeName) = sItem then begin
file://Modify the record.
StrPCopy(Config.szValue, sValue);
Check(DbiModifyRecord(hCur, @Config, True));
Break;
end;
end
else file://There was an error
if (rslt <> DBIERR_EOF) then
Check(rslt);
until (rslt <> DBIERR_NONE);
finally
file://Close the Cursor
if (hCur <> nil) then
Check(DbiCloseCursor(hCur));
end;
end;
<<<end>>>
and setting Local Share with it:
<<<<begin>>>>
Check(dbiInit(nil));
try
// ********* SET THE LOCAL SHARE PROPERTY TO TRUE *********
SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
finally
Check(dbiExit);
end;
<<<<end>>>>
Gert
Faruk,
you can use the GetConfigParams and ModifyDriver. They´re a TSession´s
methods.
Odilon Araújo
SoftSite Tecnologia
odi...@softsite.com.br
Faruk KAYNAKLI <fkay...@yahoo.com> wrote in message
news:863r5o$fi...@bornews.borland.com...
> I can change BDE configuration in BDE Administrator. How can I change
these
> settings in my program. (for example: Net Dir attribute at
> Configuration\Drivers\Native\Paradox
> or
> Local Share attribute at Configuration\System\Init)
>
> Best Regards...
> Faruk KAYNAKLI
> fkay...@yahoo.com
> fk1...@bbm.com.tr
>
>
1) Test if BDEOK.JGR file exists (you can use any unique file for that
matter). This is the signature file which is automatically created once the
BDE has been tested or set properly to the required settings. The first time
the program is executed on the machine, this file do not exist yet, and it
will let my program know that the BDE settings have not been tested.
2) If the signature file did not exist, then test the BDE and set it
correctly.
3) If settings to the BDE were made, then exit the program so that the BDE
will be reinitialized when you rerun your program, of course you must warn
the user to run your program again as in this sample.
Attach the following code to the form create event of your main form:
Remember to have
USES ...., BDE;
procedure TForm1.FormCreate(Sender:TObject);
var BDEOK:boolean; LocalShareValue:string; MaxFiles:integer;
BDEOKFile:TextFile;
ProgramDirPath:String;
begin
ShortDateFormat:='MM/DD/YYYY'; ///forcing 4-digit Y2K dates
Application.UpdateFormatSettings:=False; ///preventing users regional
setting updating
///in
case they change it outside of program
ProgramDirPath:=ExtractFilePath(Application.ExeName);
if not fileexists(ProgramDirPath+'BDEOK.JGR') then begin
ShowMessage('The program will check the settings of the Borland Database
Engine for the first time.');
BDEOK:=True;
Check(DbiInit(nil));
try
MaxFiles:=StrToInt(Trim(GetConfigParameter('\SYSTEM\INIT\;MAXFILEHANDLES',ni
l)));
LocalShareValue:=UpperCase(GetConfigParameter('\SYSTEM\INIT\;LOCAL
SHARE',nil));
if MaxFiles<80 then begin
SetConfigParameter('\SYSTEM\INIT\;MAXFILEHANDLES','99');
BDEOK:=False;
end;
if LocalShareValue='FALSE' then begin
SetConfigParameter('\SYSTEM\INIT\;LOCAL SHARE','TRUE');
BDEOK:=False;
end;
AssignFile(BDEOKFile,'BDEOK.JGR');
Rewrite(BDEOKFile);
Writeln(BDEOKFile,'MaxFileHandles: old = '+IntToStr(MaxFIles)+', new =
99');
Writeln(BDEOKFile,'Local Share : old = '+LocalShareValue +', new =
TRUE');
Writeln(BDEOKFIle,'Date/Time Corrected: '+DateTimeToStr(Now));
Closefile(BDEOKFile);
if BDEOK then begin
ShowMessage('BDE Settings are correct. Press OK to continue.');
end else begin
ShowMessage('BDE Settings have been configured for
'+Application.Title+
' The application will be closed. Please reload
'+Application.Title+' for the new settings to take effect.');
Application.Terminate;
end;
finally
Check(DBiExit);
end;
end;
end;
Jesse Castleberry <Je...@msdlg.com> wrote in message
news:891o9m$83...@bornews.borland.com...