Option Explicit
Public conn As ADODB.Connection
Public rs_barang As ADODB.Recordset
Public rs_jenis As ADODB.Recordset
Public rs_pemasok As ADODB.Recordset
Public rs_pegawai As ADODB.Recordset
Public rs_pelanggan As ADODB.Recordset
Public rs_pengguna As ADODB.Recordset
Public rs_penjualan As ADODB.Recordset
Public rs_detjual As ADODB.Recordset
Public rs_pembelian As ADODB.Recordset
Public rs_detbeli As ADODB.Recordset
Public sqlInsert As String
Public sqlUpdate As String
Public cmd As ADODB.Command
Public dbServer As String
Public Sub OpenDB()
Dim dbuser As String, dbpass As String, dbname As String
dbuser = "nasihatun"
dbpass = "nasihatun"
dbname = "nasihatun"
dbServer = "192.168.200.254"
Set conn = New ADODB.Connection
conn.Open "Provider=SQLOLEDB.1;User ID=" & dbuser & ";Password=" & dbpass & ";Initial Catalog=" & dbname & ";Data Source=" & dbServer
Set rs_pelanggan = New ADODB.Recordset
rs_pelanggan.Open "select * from pelanggan", _
conn, adOpenDynamic, adLockBatchOptimistic
Set rs_penjualan = New ADODB.Recordset
rs_penjualan.Open "select * from penjualan", _
conn, adOpenDynamic, adLockBatchOptimistic
Set rs_barang = New ADODB.Recordset
rs_barang.Open "select barang.*,jenis.nmjenis" _
& " from barang,jenis" _
& " where jenis.kdjenis=barang.kdjenis" _
, conn, adOpenDynamic, adLockBatchOptimistic
End Sub
Public Sub ExeQuery(sqlStr As String)
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandType = adCmdText
cmd.CommandText = sqlStr
End Sub
Tidak ada komentar:
Posting Komentar