- '**************************************
- 'Windows API/Global Declarations for :__
- ' ____________...:::SIJO Soft DSN:::...___
- '
- '**************************************
- ' **************************************
- ' ********************************
- ' * Comments : Some functions for DSN
- ' *
- ' *
- ' **************************************
- ' ********************************
- 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
- '**************************************
- ' Name: ______________...:::SIJO Soft DS
- ' N:::...___
- ' Description:Create / Delete DSN
- ' By: SIJO Soft Corp
- '
- '
- ' Inputs:None
- '
- ' Returns:None
- '
- 'Assumes:None
- '
- 'Side Effects:None
- 'This code is copyrighted and has limite
- ' d warranties.
- 'Please see http://www.Planet-Source-Cod
- ' e.com/xq/ASP/txtCodeId.43561/lngWId.1/qx
- ' /vb/scripts/ShowCode.htm
- 'for details.
- '**************************************
- Public Sub CreateDSN(sDSN As String)
- ' **************************************
- ' ********************************
- ' * Comments : Create a DSN
- ' *
- ' *
- ' **************************************
- ' ********************************
- Dim nRetAs Long
- Dim sDriverAs 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, O
- ' DBC_REMOVE_DSN, sDriver, sAttributes)
- End Sub
- Public Sub DeleteDSN(sDSN As String)
- ' #VBIDEUtils#**************************
- ' **********************************
- ' * Programmer Name : Waty Thierry
- ' * Web Site : www.geocities.com/Researc
- ' hTriangle/6311/
- ' * E-Mail : [email protected]
- ' * Date: 25/11/98
- ' * Time: 15:08
- ' * Module Name: DSN_Module
- ' * Module Filename : DSN.bas
- ' * Procedure Name : DeleteDSN
- ' * Parameters:
- ' * sDSN As String
- ' **************************************
- ' ********************************
- ' * Comments : Delete a DSN
- ' *
- ' *
- ' **************************************
- ' ********************************
- Dim nRetAs Long
- Dim sDriverAs String
- Dim sAttributes As String
- sDriver = "Oracle73 Ver 2.5"
- sAttributes = sAttributes & "DSN=" & sDSN & Chr$(0)
- nRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, sDriver, sAttributes)
- End Sub
SIJO Soft DSN
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.