I'm trying to configure a dsn in VBA. I will use it to switch between PERVASIVE and MSSQL for an application.
Let see the code :
DataSourceName = "P5COM"
DatabaseName = "XRTPVSW"
DriverPath = "c:\xrt\pvsw\bin\w3odbcci.dll"
DriverName = "Pervasive ODBC Engine Interface"
lResult = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\" & _
DataSourceName, hKeyHandle)
lResult = RegSetValueEx(hKeyHandle, "DBQ", 0&, REG_SZ, _
ByVal DatabaseName, Len(DatabaseName))
lResult = RegSetValueEx(hKeyHandle, "Driver", 0&, REG_SZ, _
ByVal DriverPath, Len(DriverPath))
lResult = RegCloseKey(hKeyHandle)
lResult = RegCreateKey(HKEY_LOCAL_MACHINE, _
"SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", hKeyHandle)
lResult = RegSetValueEx(hKeyHandle, DataSourceName, 0&, REG_SZ, _
ByVal DriverName, Len(DriverName))
lResult = RegCloseKey(hKeyHandle)
I have the same code for the MSSQL part. It's working with MSSQL, when I try to get into the product with the P2000 SQL DB I have the error: 80004005 unspecified error ???
I try different actions but no one works...
pleas can you help me ?
Let see the code :
DataSourceName = "P5COM"
DatabaseName = "XRTPVSW"
DriverPath = "c:\xrt\pvsw\bin\w3odbcci.dll"
DriverName = "Pervasive ODBC Engine Interface"
lResult = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\" & _
DataSourceName, hKeyHandle)
lResult = RegSetValueEx(hKeyHandle, "DBQ", 0&, REG_SZ, _
ByVal DatabaseName, Len(DatabaseName))
lResult = RegSetValueEx(hKeyHandle, "Driver", 0&, REG_SZ, _
ByVal DriverPath, Len(DriverPath))
lResult = RegCloseKey(hKeyHandle)
lResult = RegCreateKey(HKEY_LOCAL_MACHINE, _
"SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", hKeyHandle)
lResult = RegSetValueEx(hKeyHandle, DataSourceName, 0&, REG_SZ, _
ByVal DriverName, Len(DriverName))
lResult = RegCloseKey(hKeyHandle)
I have the same code for the MSSQL part. It's working with MSSQL, when I try to get into the product with the P2000 SQL DB I have the error: 80004005 unspecified error ???
I try different actions but no one works...
pleas can you help me ?