Imports System.Data.OleDb Public Class frm_patientrecords 'making the database connection Dim con As New OleDbConnection Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick con.ConnectionString = "Provider=microsoft.jet.oledb.4.0; data source = C:\trail.accdb" con.Open() datagridShow() End Sub 'call the grid property and object Private Sub datagridShow() Dim ds As New DataSet Dim dt As New DataTable 'parse the data set into the table ds.Tables.Add(dt) Dim da As New OleDbDataAdapter da = New OleDbDataAdapter("select * from patients", con) da.Fill(dt) DataGridView1.DataSource = dt.DefaultView con.Close() End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)