Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i have grid view and it content data from one table name as empdata and i have put check box in grid view column. now i have to store the data which is available in grid view to another table name as attendance. i don't understand which kind of value to have use in insert query. please help.

following is my code for gridview
VB
Private Sub filldata()
        Dim cmd As New OleDbCommand
        Dim dr As OleDbDataReader
        cmd.Connection = cn
        cmd.CommandText = "select empid,fname,designation from empdata order by empid"
        dr = cmd.ExecuteReader
        Dim dt As New DataTable
        dt.Load(dr)
        grd.DataSource = dt
        dt.Dispose()
        If dr.IsClosed = False Then dr.Close()
        grd.Columns(0).HeaderText = "Emp Id"
        grd.Columns(1).HeaderText = "Emp Name"
        grd.Columns(2).HeaderText = "Designation"
        grd.Columns.Add(grdchk)
        grd.Columns(3).HeaderText = "Attandance"
        grdchk.ThreeState = True
        grd.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
    End Sub

and now i don't know which value to have use
VB
Private Sub btnsave_Click(sender As System.Object, e As System.EventArgs) Handles btnsave.Click
        Dim cmd As New OleDbCommand
        grdchk = IIf(CheckState.Checked, "Present", "Absent")
        cmd.Connection = cn
        cmd.CommandText = "insert into attandance values("
    End Sub


What I have tried:

i don't know what to have try. :)
Posted
Updated 8-Jul-17 2:11am

1 solution

 
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