OLEDB Connection

OLEDB Connection
OBJEK OLEDB CONNECTION is the object used many for application client-server.
We can exploit this object to handle the problem koneksi with :
  • SQL SERVER
  • MICROSOFT ACCESS
  • ORACLE
MEMBER OBJEK OLEDBCONNECTION :
  1. Properties
    1. Connection String
    2. Connection TimeOut
    3. Database
    4. Provider
    5. Server Version
    6. State
  1. Method
    1. ChangeDatabase
    2. Close
    3. CreateCommand
    4. GetOleDbSchemaTable
    5. Open
Way to Use :
  1. Require library object from :
imports system.data.oledb
  1. Syntaks declaration :
Dim con ace new oledbconnection
  1. Inisialisasi value :
Connect to Ms. Access
Con.connectionstring = “ provider = Microsoft.Jet.Oledb.4.0; data source = filename”
Connect to SQLServer
Con.connectionstring = “ provider = SQLOLEDB; data source = nama_server;user id = user_SQLServer;password = password_user; initial catalog = Nama_Database; connect timeout = nilai_timeout”
  1. Connect to Database
con.open()
  1. Cover Koneksi
con.close()
Example [of] :
Imports System.Data.oledb Module Module1
Sub Main()
Dim strcon Ace String Dim con Ace New OleDbConnection
strcon == " provider = Microsoft.Jet.Oledb.4.0; data source = Z:\Db withVB.NET\Contoh Latihan\Access DB\LatihanDB.mdb;"
con.ConnectionString = strcon con.Open()
Console.Writeline(Con.Connectionstring)
Console.Readline()
con.Close()
End Sub
End Module

No comments: