Re: Register Database to ODBC DSN Database by VB program
- From: Paul Clement <UseAdddressAtEndofMessage@xxxxxxxxxxxxxx>
- Date: Mon, 13 Feb 2006 09:59:38 -0600
On Mon, 13 Feb 2006 10:26:05 +0300, Stas <stsn2000@xxxxxxx> wrote:
¤ Hello all!
¤ I need register my Database (MDB) to ODBC DSN Database by VB programm
¤ Where I can found example!
If I understand your question you want to create an ODBC DSN for an Access database:
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 ODBC_ADD_SYS_DSN = 4 ' Add System DSN
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
Dim intRet As Long
Dim strDriver As String
Dim strAttributes As String
strDriver = "Microsoft Access Driver (*.mdb)"
strAttributes = "DESCRIPTION=MyDSN" & Chr$(0)
strAttributes = strAttributes & "DSN=MyDSN" & Chr$(0)
strAttributes = strAttributes & "DBQ=e:\MyDocuments\db1.mdb" & Chr$(0)
intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_SYS_DSN, strDriver, strAttributes)
Paul
~~~~
Microsoft MVP (Visual Basic)
.
- References:
- Prev by Date: Re: Linked Table Manager via VB
- Next by Date: Re: Importing from Excel
- Previous by thread: Register Database to ODBC DSN Database by VB program
- Next by thread: Re: Register Database to ODBC DSN Database by VB program [multiposted]
- Index(es):
Relevant Pages
|