>I have an application in the works that will be installed on multiple servers. In each of these installs, the application scans for certain tables, creates a TXT file in a shared folder and then needs to call BULK INSERT on a SQL Server to upload the data.
>
>I need to determine the UNC name for the share I create the TXT file in, so I can pass it as a parameter for the BULK INSERT call.
>
>How do I determine the UNC name?
Try this
CLEAR
? GetUnc([K:])
RETURN
FUNCTION GetUnc(lcMapedDevice)
DECLARE INTEGER WNetGetConnection IN Win32API ;
STRING @cLocalDrive, ;
STRING @cRemoteUNCBuffer, ;
INTEGER @nSizeOfBuffer
cBuffer = SPACE(511)
nResult = WNetGetConnection(lcMapedDevice, ;
@cBuffer, ;
511)
IF nResult # 0
RETURN ''
ELSE
RETURN LEFT(cBuffer,AT(CHR(0),cBuffer)-1)
ENDIF
HTH
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst