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
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim DsnName As String = "Search1" Dim PathDB As String = "E:\Rachna\LocalityDd.mdb" Dim UID As String = "" Dim PAssWord As String = "" Const ODBC_ADD_DSN = 1 'Add User DSN Dim rl As Long Dim Strsetting As String = "" Strsetting = Strsetting + "dsn=" & DsnName Strsetting = Strsetting + ";" + "DBQ=" & PathDB '& Chr(0) & Strsetting Strsetting = Strsetting + ";" + "uid=" & UID '& Chr(0) & Strsetting Strsetting = Strsetting + ";" + "pwd=" & PAssWord '& Chr(0) & Strsetting rl = SQLConfigDataSource(0&, ODBC_ADD_DSN, "Microsoft Access Driver (*.mdb)", Strsetting) If rl = 1 Then MsgBox("Created ODBC") Else MsgBox("Error") End If End Sub
Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" ( _ ByVal hwndParent As Int32, ByVal fRequest As Int32, _ ByVal lpszDriver As String, ByVal lpszAttributes As String) As Int32
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)