Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System DSN

Status
Not open for further replies.

jtmach

Programmer
Jul 26, 2001
88
US
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.
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)
The hardest questions always have the easiest answers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top