Click here to Skip to main content
15,898,010 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do i get the data from the ms-access into the datagridview on cell entry in the datagridview itself in the vb.net.
Posted
Updated 2-Mar-14 0:36am
v2

1 solution

Imports System.Data
Imports System.Data.SqlClient

Public Class frmattendence

    Dim con As New SqlConnection("Data Source=Tarun-PC;Initial Catalog=couriermanagementsystem;Integrated Security=True")
    Private da As SqlDataAdapter
    Private dt As DataTable
    Private ds As DataSet
    Private cmdselect, cmddelete As String

    Private Sub frmattendence_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Calling this method for execution whrn form loads
        LoadRecord()
    End Sub
    
    'This method calls values from database put in datagridview  

    ' Actually you have to Focus on this part only
    Private Sub LoadRecord()

        cmdselect = "select ID,Name,Gender,Position from tblcouriercompany"
        da = New SqlDataAdapter(cmdselect, con)
        dt = New DataTable()
        da.Fill(dt)
        DataGridView1.DataSource = dt

    End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900