Sabtu, 14 Mei 2011

Contoh source program untuk KONEKSI ke Database

Imports System.Data
Imports System.Data.Sql

Module Module1
Public DataAdit As New OleDb.OleDbConnection
Public Tampil As New OleDb.OleDbCommand
Public Tampilkan As OleDb.OleDbDataReader
Public adapter As New OleDb.OleDbDataAdapter
Public ds As New DataSet
Public Tabel, hasilcek As String
Public record As New BindingSource
Public adit As Integer
Public DmlSql As New OleDb.OleDbCommand

Public Sub mykoneksi()
Try
DataAdit.Close()
'server
'DataAdit.ConnectionString = "Provider=SQLOLED.1;Password=;Persist Security Info=True;User ID=sa;Initial Catalog=sim_akuntansi;Data Source=200.200.10.150"

'lokal
DataAdit.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Klinik_Adit;Data Source=."

DataAdit.Open()


Catch ex As Exception
MsgBox("Koneksi ERROR")

End Try
MsgBox("Koneksi Berhasil")

End Sub

End Module

Tidak ada komentar:

Posting Komentar