Koneksi ORACLE dengan ADODB dengan Visual Basic 6


Image project

Project Code ;

Option Explicit
Public CnORA As ADODB.Connection
Public Rs As New ADODB.Recordset

Private Sub Command1_Click() ‘ tombol Open Koneksi
Set CnORA = New ADODB.Connection
CnORA.ConnectionString = “Provider=MSDAORA.1;Password=SKA;User ID=SKA;Data Source=SAUFI;Persist Security Info=True”
CnORA.Open
If CnORA.State = adStateOpen Then
MsgBox “Koneksi OK”
Else
MsgBox “Koneksi Gagal”
End If
End Sub

Private Sub Command2_Click() ‘ tombol close koneksi
If CnORA.State = adStateOpen Then
CnORA.Close
MsgBox “Koneksi Tertutup”
Else
MsgBox “Koneksi Sudah Tertutup”
End If
Unload Me
End Sub

Private Sub Command3_Click() ‘tombol getdata
If Rs.State = adStateOpen Then Rs.Close
Rs.Open “Select * from TBLORDJUALHEADER”, CnORA, adOpenKeyset, adLockReadOnly
Set vsf.DataSource = Rs
vsf.Refresh
End Sub

About alkahfi

Bekerja di bidang IT-MIS di sebuah perusahaan Optik di Medan, sebagai Software Enginer.

Posted on April 18, 2008, in Programming and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: