OleDbConnection Connection String for Access database in VB.NET

Category > VBVB.NET || Published on : Sunday, October 11, 2020 || Views: 171 || OleDbConnection Connection String for Access database in VB.NET


Here Pawan Kumar will explain how to OleDbConnection Connection String for Access database in VB.NET

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Windows.Forms
Imports System.Resources

Public Class MainClass
    Shared Sub Main()
      Dim OleDbConnection As System.Data.OleDb.OleDbConnection
      OleDbConnection = New System.Data.OleDb.OleDbConnection()

      OleDbConnection.ConnectionString = _
         "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";" & _
         "User ID=Admin;Data Source=Employee.mdb;Mode=Sha" & _
         "re Deny None;Extended Properties="""";" & _
         "Jet OLEDB:System database="""";Jet OLEDB:Regis" & _
         "try Path="""";Jet OLEDB:Database Password="""";" & _
         "Jet OLEDB:Engine Type=5;Jet OLEDB:Dat" & _
         "abase Locking Mode=1;Jet OLEDB:Global Partial " & _
         "Bulk Ops=2;Jet OLEDB:Global Bulk T" & _
         "ransactions=1;Jet OLEDB:New Database " & _
         "Password="""";Jet OLEDB:Create System Databas" & _
         "e=False;Jet OLEDB:Encrypt Database=False;" & _
         "Jet OLEDB:Don't Copy Locale on Compact=" & _
         "False;Jet OLEDB:Compact Without Replica " & _
         "Repair=False;Jet OLEDB:SFP=False"


      Try
         OleDbConnection.Open()
         OleDbConnection.Close()
      Catch ex As Exception
         Console.WriteLine(ex.Message)
      End Try

    End Sub
    
End Class