Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing BDE configuration in code?

134 views
Skip to first unread message

Faruk KAYNAKLI

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
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

Odilon Araújo

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
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...

Gert Kello

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
> 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
//Open the idapi.cfg and read details for the node given
Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT,
StrPCopy(temp, sNode), hCur));
try
//Go to the top of the node.
Check(DbiSetToBegin(hCur));
//Go thru each leaf in the node until we come to the required item.
repeat
//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
//Modify the record.
StrPCopy(Config.szValue, sValue);
Check(DbiModifyRecord(hCur, @Config, True));
Break;
end;
end
else //There was an error
if (rslt <> DBIERR_EOF) then
Check(rslt);
until (rslt <> DBIERR_NONE);
finally
//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

Jan Sprengers

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
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


Bill Todd (TeamB)

unread,
Jan 19, 2000, 3:00:00 AM1/19/00
to
See the examples for DbiOpenCfgInfoList at
www.borland.com/devsupport/bde/bdeapiex.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Andreas Wagner

unread,
Jan 20, 2000, 3:00:00 AM1/20/00
to
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)

Gert Kello

unread,
Jan 20, 2000, 3:00:00 AM1/20/00
to
> SetConfigValue('\DRIVERS\NATIVE\PARADOX\', 'NET DIR', 'c:\');

It should be:
SetConfigValue('\DRIVERS\PARADOX', 'NET DIR', 'c:\');

Gert


ghong...@gmail.com

unread,
Jun 9, 2014, 11:05:31 PM6/9/14
to
SetConfigValue('\Drivers\PARADOX\INIT','NET DIR', 'd:\');


Andreas Wagner於 2000年1月20日星期四UTC+8下午4時00分00秒寫道:
> That work fine with your example
>
> SetConfigValue('\SYSTEM\INIT', 'LOCAL SHARE', 'TRUE');
>
> I try it with
>
> SetConfigValue('\DRIVERS\NATIVE\PARADOX\', 'NET DIR', 'c:\');
>
0 new messages