DBEngine.RegisterDatabase dbname, driver, silent, attributes

解决方案 »

  1.   

          Private Const ODBC_ADD_DSN = 1        ' Add data source
          Private Const ODBC_CONFIG_DSN = 2    ' Configure (edit) data source
          Private Const ODBC_REMOVE_DSN = 3    ' Remove data source
          Private Const vbAPINull As Long = 0&  ' NULL Pointer
    Private Declare Function SQLAllocEnv Lib "odbc32.dll" (phenv&) As Integer
          'Function Declare
              Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL"(ByVal hwndParent As Long, ByVal fRequest As Long,ByVal lpszDriver As String, ByVal lpszAttributes As String)As Long