I am trying to create a system DSN by using the code below. The code works (in that the DSN is created) however I am not able to use the DSN in other programs until I go into the control panel and test it. Once I have hit test it works fine. Any ideas on how to get this to work completly from code would be appreciated. Thank you.
J.t.
The hardest questions always have the easiest answers.
J.t.
Code:
#If Win32 Then
Dim intRet As Long
#Else
Dim intRet As Integer
#End If
Dim strDriver As String
Dim strAttributes As String
'Set the driver to SQL Server because it is most common.
strDriver = "SQL Server"
'Set the attributes delimited by null.
'See driver documentation for a complete
'list of supported attributes.
strAttributes = "SERVER=DS05DIPK" & Chr$(0)
strAttributes = strAttributes & "DESCRIPTION=PROD" & Chr$(0)
strAttributes = strAttributes & "DSN=RiMMs" & Chr$(0)
strAttributes = strAttributes & "DATABASE=LOGDB001" & Chr$(0)
'To show dialog, use Form1.Hwnd instead of vbAPINull.
intRet = SQLConfigDataSource(vbAPINull, 4, strDriver, strAttributes)