Modify alias pathname in code

Modify alias pathname in code

Post by MARTOT S├ębastie » Sat, 12 Oct 1996 04:00:00



How to modify the pathname of an existing alias in code
with Delphi 1.

DbiDeleteAlias doesn't exist.

Please help me

Thank you

 
 
 

Modify alias pathname in code

Post by Blake Schwendima » Sat, 12 Oct 1996 04:00:00


This is a how I do it:

procedure ...
var
    config     : ^CFGDesc;
    nIndex     : Integer;
    curs       : hDBICur;
    found      : Boolean;
    result     : DBIResult;
begin
    GetMem( config, sizeof( CFGDesc ) );

    {
        On following line, replace xxx with alias name:
        such as \DATABASES\MY ALIAS\DB INFO\
    }
    DbiOpenCfgInfoList( nil, dbiREADWRITE, cfgPersistent,
'\DATABASES\xxx\DB INFO\' );
    found  := FALSE;
    result := DbiGetNextRecord( curs, dbiNOLOCK, config, nil );
    while ( ( result = 0 ) and ( found = FALSE ) ) do
    begin
        if ( strcomp( config^.szNodeName, 'PATH' ) = 0 ) then
        begin
            found := TRUE;

                { Change to new path here }

            StrCopy( config^szValue, 'c:\' );
            DbiModifyRecord( curs, dbiNOLOCK, config, nil );
        end;
        result := DbiGetNextRecord( curs, dibNOLOCK, config, nil );
    end;
    FreeMem( config, sizeof( CFGDesc ) );
end;

Good luck,
Blake Schwendiman
Ag Decisions, Inc.



Quote:> How to modify the pathname of an existing alias in code
> with Delphi 1.

> DbiDeleteAlias doesn't exist.

> Please help me

> Thank you