However, when I have needed to use ODBC I use a File DSN. I just create the File DSN on my computer, then copy it to the target machine as part of the installation process. To update the DSN just edit the File DSN - it's a text file and easy to edit.
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
Const ODBC_ADD_SYS_DSN = 4 'Add data source
Const ODBC_CONFIG_SYS_DSN = 5 'Configure (edit) data source
Const ODBC_REMOVE_SYS_DSN = 6 'Remove data source
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
Function Build_SystemDSN(ByVal DSN_NAME As String, ByVal Db_Path As String)
ret = SQLConfigDataSource(0, ODBC_ADD_SYS_DSN, Driver, Attributes)
'ret is equal to 1 on success and 0 if there is an error
If ret <> 1 Then
MsgBox("DSN Creation Failed")
End If
End Function
But i am getting the error as "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.". Can anyone please help me?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.