Blogger news

Blogroll

Blogger templates

KONEKSI VB 6 DENGAN ACCES 2003, ORACLE DAN SQL SERVER


Option Explicit
Public Declare Function InitCommonControls Lib "comctl32.dll" () As Long  'Untuk menampilkan skin

As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long

Public CN As New ADODB.Connection
Public JAWAB As String
Public BlobValue As New ADODB.Stream

Public Sub poeNx()
On Error GoTo ErrorConnection
Set CN = New ADODB.Connection
CN.CursorLocation = adUseClient
CN.Provider = "Microsoft.Jet.OLEDB.4.0"
'==================================
        CN.Open App.Path & "/POENX.mdb" '=====> jika acces

ErrorConnection:
        If Err.Number = 3709 Then
           MsgBox "Gagal berkoneksi dengan database !!!", vbExclamation, "Koneksi Gagal", 4
           End
        End If

'koneksi sql server====================================================

'buka koneksi dari sql dengan password 1234 dengan user nama sa dari database siswa dengan nama sql conection SOLO-E56A60CEDD

'CN.Open "Provider=SQLOLEDB.1;Password=1234;Persist Security Info=True;User ID=sa;Initial Catalog=POENX;Data Source=POENX-PC"
'ErrorConnection:
'If Err.Number = -2147467259 Then
 '   MsgBox "Gagal berkoneksi dengan database !!!", vbExclamation, "Koneksi Gagal", 3
  '  End
   ' Exit Sub
'End If
'AWAL.Show

'koneksi oracle=================================================================
'On Error GoTo erhan
   '     SQLString = "Provider= OraOLEDB.Oracle.1; Password=1234; Persist Security Info=True; User ID=pupung"
  '      CN.Open SQLString
 '       CN.CommandTimeout = 0
'Exit Sub
'erhan:
'MsgBox Err.Description

End Sub



'======================
kemudian di tiap forn di even load ketikan skirp ini

poeNx

Comments :

0 komentar to “KONEKSI VB 6 DENGAN ACCES 2003, ORACLE DAN SQL SERVER”

Posting Komentar

Diberdayakan oleh Blogger.

You can replace this text by going to "Layout" and then "Page Elements" section. Edit " About "