Senin, 30 Mei 2011

Modul koneksi

Imports System.Data
Imports System.Data.Sql
Module koneksidatabase
Public Database As New OleDb.OleDbConnection
Public Tampil As New OleDb.OleDbCommand
Public Tampil2 As New OleDb.OleDbCommand
Public Tampilkan As OleDb.OleDbDataReader
Public hasiljur, jur, hasilcek As String

Public Sub Koneksi()
Try
Database.Close()
'server'
'Database.ConnectionString = "Provider=SQLOLEDB.1;Password=123456;Persist Security Info=True;"User ID=sasa;Initial Catalog=PTJayaKarta;Data Source=192.168.10.4

'lokal
Database.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TI4P;Data Source=."
Database.Open()
'Tampil.Connection = Database
MsgBox(" Koneksi Berhasil ")
Catch ex As Exception
MsgBox(ex.ToString)
End Try

Sintax Koneksi

Imports System.Data
Imports System.Data.Sql

Module koneksi

Public yongki As New OleDb.OleDbConnection
Public tampil As New OleDb.OleDbCommand
Public tampil2 As New OleDb.OleDbCommand
Public tampilkan As OleDb.OleDbDataReader
Public hasiljur, jur As String

Public Sub koneksi()
Try
yongki.Close()
'server
'yongki.Connectionstring = "Provider=SQLOLEDE.1;Password=sasa;Persist Security
'info=True;User ID=sa;Initial Catalog=TI4AK;Data Source=192.168.10.44"
'lokal
yongki.ConnectionString = "Provider=SQLOLEDB.1;Integrated security=SSPI;persist security=Info=false;Initial Catalog=johan;data source=.;"
yongki.Open()
'Tampil.Connection = yongki
MsgBox("koneksiberhasil")
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
End Module

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Elf Coupons