Private Function GetAppPath() As String Dim path As String path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location) Return path End Function
Dim m_sConn1 As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & GetAppPath() & "\" & inDist & ".xlsx;;Extended Properties=""Excel 12.0 Xml;HDR=Yes""" Dim ExcelConnection As New System.Data.OleDb.OleDbConnection(m_sConn1) ExcelConnection.Open()
Exactly what do you mean when you say neither worked?path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location)This returns the full path to the directory that contains your assembly dll. If the config file is in this same directory then all you need to do is append the filename to this path.
Les membres connectés peuvent publier, suivre les mises à jour et bien plus encore. Vous êtes nouveau ici ? Créez un compte gratuit.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.