Search the web
Sign In
New User? Sign Up
fdb · FDB's "Advanced Programming" list
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
DSN   Message List  
Reply | Forward Message #49 of 103 |
If you need to quickly create and delete a Date Source Name (DSN) on the
fly, use the code to do so. Authored by Waty Thierry.

Tip Code:

Option Explicit

'Declarations Used to Generate DSN
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 SQLConfigDataSource Lib "ODBCCP32.DLL" _
(ByVal hwndParent As Long, ByVal fRequest As Long, ByVal lpszDriver _
As String, ByVal lpszAttributes As String) As Long

Public Sub CreateDSN(sDSN As String)
Dim nRet As Long
Dim sDriver As String
Dim sAttributes As String

sDriver = "Oracle73 Ver 2.5"
sAttributes = "Server=pressdb.world" & Chr$(0)
sAttributes = sAttributes & "DESCRIPTION=" & sDSN & Chr$(0)
sAttributes = sAttributes & "DSN=" & sDSN & Chr$(0)
sAttributes = sAttributes & "DATABASE=DB" & Chr$(0)
sAttributes = sAttributes & "UID=Waty" & Chr$(0)
sAttributes = sAttributes & "PWD=myPassword" & Chr$(0)

DBEngine.RegisterDatabase "kiki", "Oracle73 Ver 2.5", True, sAttributes

nRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, sDriver,
sAttributes)
End Sub

Public Sub DeleteDSN(sDSN As String)
Dim nRet As Long
Dim sDriver As String
Dim sAttributes As String

sDriver = "Oracle73 Ver 2.5"
sAttributes = sAttributes & "DSN=" & sDSN & Chr$(0)

nRet = SQLConfigDataSource(vbAPINull, ODBC_REMOVE_DSN, sDriver,
sAttributes)

End Sub





Fri Jun 29, 2001 2:50 pm

ferialb@...
Send Email Send Email

Forward
Message #49 of 103 |
Expand Messages Author Sort by Date

If you need to quickly create and delete a Date Source Name (DSN) on the fly, use the code to do so. Authored by Waty Thierry. Tip Code: Option Explicit ...
FDB & HRB
ferialb@...
Send Email
Jun 29, 2001
2:52 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help