现在的位置: 首页 > 综合 > 正文

SIJO Soft DSN

2013年08月08日 ⁄ 综合 ⁄ 共 3024字 ⁄ 字号 评论关闭
  1. '**************************************
  2. 'Windows API/Global Declarations for :__
  3. '     ____________...:::SIJO Soft DSN:::...___
  4. '     
  5. '**************************************
  6. ' **************************************
  7. '     ********************************
  8. ' * Comments : Some functions for DSN
  9. ' *
  10. ' *
  11. ' **************************************
  12. '     ********************************
  13. Option Explicit
  14. 'Declarations Used to Generate DSN
  15. Private Const ODBC_ADD_DSN = 1 ' Add data source
  16. Private Const ODBC_CONFIG_DSN = 2' Configure (edit) data source
  17. Private Const ODBC_REMOVE_DSN = 3' Remove data source
  18. Private Const vbAPINull As Long = 0& ' NULL Pointer
  19. Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As LongByVal fRequest As LongByVal lpszDriver As StringByVal lpszAttributes As StringAs Long
  20. '**************************************
  21. ' Name: ______________...:::SIJO Soft DS
  22. '     N:::...___
  23. ' Description:Create / Delete DSN
  24. ' By: SIJO Soft Corp
  25. '
  26. '
  27. ' Inputs:None
  28. '
  29. ' Returns:None
  30. '
  31. 'Assumes:None
  32. '
  33. 'Side Effects:None
  34. 'This code is copyrighted and has limite
  35. '     d warranties.
  36. 'Please see http://www.Planet-Source-Cod
  37. '     e.com/xq/ASP/txtCodeId.43561/lngWId.1/qx
  38. '     /vb/scripts/ShowCode.htm
  39. 'for details.
  40. '**************************************
  41. Public Sub CreateDSN(sDSN As String)
  42.     ' **************************************
  43.     '     ********************************
  44.     ' * Comments : Create a DSN
  45.     ' *
  46.     ' *
  47.     ' **************************************
  48.     '     ********************************
  49.     Dim nRetAs Long
  50.     Dim sDriverAs String
  51.     Dim sAttributes As String
  52.     sDriver = "Oracle73 Ver 2.5"
  53.     sAttributes = "Server=pressdb.world" & Chr$(0)
  54.     sAttributes = sAttributes & "DESCRIPTION=" & sDSN & Chr$(0)
  55.     sAttributes = sAttributes & "DSN=" & sDSN & Chr$(0)
  56.     sAttributes = sAttributes & "DATABASE=DB" & Chr$(0)
  57.     sAttributes = sAttributes & "UID=Waty" & Chr$(0)
  58.     sAttributes = sAttributes & "PWD=myPassword" & Chr$(0)
  59.     DBEngine.RegisterDatabase "kiki""Oracle73 Ver 2.5"True, sAttributes
  60.     'nRet = SQLConfigDataSource(vbAPINull, O
  61.     '     DBC_REMOVE_DSN, sDriver, sAttributes)
  62. End Sub
  63. Public Sub DeleteDSN(sDSN As String)
  64.     ' #VBIDEUtils#**************************
  65.     '     **********************************
  66.     ' * Programmer Name : Waty Thierry
  67.     ' * Web Site : www.geocities.com/Researc
  68.     '     hTriangle/6311/
  69.     ' * E-Mail : waty.thierry@usa.net
  70.     ' * Date: 25/11/98
  71.     ' * Time: 15:08
  72.     ' * Module Name: DSN_Module
  73.     ' * Module Filename : DSN.bas
  74.     ' * Procedure Name : DeleteDSN
  75.     ' * Parameters:
  76.     ' * sDSN As String
  77.     ' **************************************
  78.     '     ********************************
  79.     ' * Comments : Delete a DSN
  80.     ' *
  81.     ' *
  82.     ' **************************************
  83.     '     ********************************
  84.     Dim nRetAs Long
  85.     Dim sDriverAs String
  86.     Dim sAttributes As String
  87.     sDriver = "Oracle73 Ver 2.5"
  88.     sAttributes = sAttributes & "DSN=" & sDSN & Chr$(0)
  89.     nRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, sDriver, sAttributes)
  90. End Sub

抱歉!评论已关闭.