Results 1 to 2 of 2

Thread: To Michelle

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Location
    Dubai
    Posts
    24
    Hello Michelle,
    This regarding the answer to my question.
    Shall I explain my problem ?
    This is an accounting s/w.I am using different databases.When the user creates a new company ,I am creating a new database and storing that path in a table which is in master database.
    I made the whole c drive sharing.But my question is, when I run the package I am opening the connection by selecting the corresponding path stored in the database.
    Another system on a n/w,how it will accept the path "c:\fbfjf" ?
    Hope you got me now.





  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    I assume you are reffering to 'Mapped' network drives on other PCs looking at your Shared C:\?

    Then use a UNC path name:

    The following gives an example:
    Code:
        ' These represent the possible returns errors from API.
        Public Const ERROR_BAD_DEVICE           As Long = 1200
        Public Const ERROR_CONNECTION_UNAVAIL   As Long = 1201
        Public Const ERROR_EXTENDED_ERROR       As Long = 1208
        Public Const ERROR_MORE_DATA            As Long = 234
        Public Const ERROR_NOT_SUPPORTED        As Long = 50
        Public Const ERROR_NO_NET_OR_BAD_PATH   As Long = 1203
        Public Const ERROR_NO_NETWORK           As Long = 1222
        Public Const ERROR_NOT_CONNECTED        As Long = 2250
        Public Const NO_ERROR                   As Long = 0
        
        ' This API declaration is used to return the
        ' UNC path from a drive letter.
        Declare Function WNetGetConnection Lib "mpr.dll" Alias _
                         "WNetGetConnectionA" _
                         (ByVal lpszLocalName As String, _
                         ByVal lpszRemoteName As String, _
                         cbRemoteName As Long) As Long
    
    
    Function F_GetUNCPath( _
                          ByVal strDriveLetter As String, _
                          ByRef strUNCPath As String _
                          ) As Long
    
        On Local Error GoTo GetUNCPath_Err
        Dim Msg             As String
        Dim lngReturn       As Long
        Dim strLocalName    As String
        Dim strRemoteName   As String
        Dim lngRemoteName   As Long
        
        strLocalName = strDriveLetter
        strRemoteName = String$(255, Chr$(32))
        lngRemoteName = Len(strRemoteName)
        
        lngReturn = WNetGetConnection( _
                                      strLocalName, _
                                      strRemoteName, _
                                      lngRemoteName _
                                      )
        If lngReturn = NO_ERROR Then
            '// Return the UNC through the function.
            F_GetUNCPath = NO_ERROR
            strUNCPath = Trim$(strRemoteName)
            strUNCPath = Left$(strUNCPath, Len(strUNCPath) - 1)
        Else
            '// Return the original driveletter & error.
            F_GetUNCPath = lngReturn
            strUNCPath = strDriveLetter & "\"
        End If
        
    GetUNCPath_End:
        Exit Function
    GetUNCPath_Err:
        F_GetUNCPath = ERROR_NOT_SUPPORTED
        strUNCPath = strDriveLetter
        Resume GetUNCPath_End
    End Function
    Call with the following:
    Code:
        Dim strUNC As String
        If F_GetUNCPath("C:", strUNC) = NO_ERROR Then
            strPath = strUNC & "fbfjf"
        Else
            strPath = "C:\fbfjf"
        End If
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width