[DUG] Mapped drives

Jan Bakuwel jan.bakuwel at omiha.com
Wed Apr 6 10:03:39 NZST 2011


Hi Wallace,


On 05/04/11 11:30, Marshland Engineering wrote:
> Hi Chaps
>  
> Sorry I made a slight mistake. The remote PC's all connect correctly.
> It is the server that has the hiccup.
> I'm using absolute database and I get
>  
> dbTT:Database file p:\TTabs\TT.abs does not exist.
>  
> Once I view P: with windows explorer, the package works fine.
>  
> P: is set to reconnected at logon.

The Delphi app is on a remote PC and the database file is on the server
mapped as P: drive?
Is the client with the Delphi app saying that the database file does not
exist or the Delphi app on the server?
Sorry mate, it's not clear.

You could refresh/reconnect/connect the mapping in your Delphi code.
Extracted (not tested) from a piece of software I wrote a long time ago:

var
  nrShare: TNetResourceA;
  dwResult: DWORD;
begin
  with nrShare do
  begin
    dwType := RESOURCETYPE_DISK;
    dwScope := RESOURCE_GLOBALNET;
    dwDisplaytype := RESOURCEDISPLAYTYPE_GENERIC;
    dwUsage := RESOURCEUSAGE_CONNECTABLE;
    lpLocalName := PAnsiChar ('P:');
    lpRemoteName := PAnsiChar ('\\SERVER\SHARE');
    lpProvider := '';
    lpComment := '';
  end;
  dwResult := WNetAddConnection2A (nrShare, PAnsiChar ('user'),
PAnsiChar ('password'), 0);
  if dwResult = NO_ERROR then
  begin
     // all is well
  end else begin
     // handle the error
  end;
end;
 
cheers,
Jan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20110406/1de3f6c4/attachment.html 


More information about the Delphi mailing list