0% found this document useful (0 votes)
28 views

Module Koneksi: Moduleku Oledbconnection Oledbdataadapter Dataset Oledbcommand Oledbdatareader

This document contains code for connecting to an Access database and retrieving data to display in a data grid view. It defines a connection string and connection object. It also defines data adapter, dataset, command and reader objects. The code opens the connection if closed and then loads data from a table into the dataset using the data adapter. This dataset is then set as the data source for a data grid view, formatting the columns.

Uploaded by

Philipus Making
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Module Koneksi: Moduleku Oledbconnection Oledbdataadapter Dataset Oledbcommand Oledbdatareader

This document contains code for connecting to an Access database and retrieving data to display in a data grid view. It defines a connection string and connection object. It also defines data adapter, dataset, command and reader objects. The code opens the connection if closed and then loads data from a table into the dataset using the data adapter. This dataset is then set as the data source for a data grid view, formatting the columns.

Uploaded by

Philipus Making
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Module koneksi

Imports System.Data.OleDb
Module Moduleku
Public conn As OleDbConnection
Public da As OleDbDataAdapter
Public ds As DataSet
Public cmd As OleDbCommand
Public rd As OleDbDataReader
Public str As String
Public Sub koneksi()
str = "Provider=Microsoft.ACE.OLEDB.12.0; Data
Source=D:\Kelas2\database1.ACCDB"
conn = New OleDbConnection(str)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
End Sub
End Module

Listing form
Imports System.Data.OleDb
Public Class Form6
Private Sub FormPenerbit_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call koneksi()
da = New OleDbDataAdapter("SELECT * FROM karyawan ", conn)
ds = New DataSet
ds.Clear()
da.Fill(ds, "karyawan")
DataGridView1.DataSource = (ds.Tables("karyawan"))
DataGridView1.Columns(0).Width = 77
DataGridView1.Columns(1).Width = 250
DataGridView1.Columns(1).Width = 250
End Sub
End Class

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy