hi i need help ASAP ....i created an payroll system with automatic counted of total hours from 03/22/2018 to 03/25/2018
i have a MySQL database column No,Name,date,Position,time_IN and time_OUT
the DataGridView has 3 column, header date,time_IN and time_OUT
i have button "Fill", that once i click all the total time_IN and time_OUT of one employee from 03/22/2018 to 03/30/2018 show in textbox(total) and all the date, time_IN and time_OUT information must show in datagridview
i have time information here: (one employee)
date=22/03/2018,time_IN=7:00,time_OUT=17:30
date=23/03/2018,time_IN=6:30,time_OUT=17:20
date=24/03/2018,time_IN=6:45,time_OUT=17:05
date=25/03/2018,time_IN=6:10,time_OUT=17:10
note:any time and minute that is less than 7:00 will start her/his time at 7:00 and once it greater than 7:00 counted as 1 hour late
note: any time that is greater than 17:00 still counted as 17:00 then less than 16:30 counted as undertime
any comment and suggestion......
What I have tried:
i have try this code this is incomplete because from mysql query, the value i need to see to datagridview doesn't appear
<pre> Try
conn.Open()
query = New MySqlCommand("SELECT No, Name, date,position,time_IN ,time_OUT From cash_table WHERE No=" & txtID.Text & " AND (date BETWEEN '" & DateTimePicker2.Value.Date & "' AND '" & DateTimePicker3.Value.Date & "')", conn)
dr = query.ExecuteReader()
If dr.HasRows Then
Do While dr.Read()
txtName.Text = dr.GetString("Name")
txtPosition.Text = dr.GetString("position")
arr(0) = dr.Item("date")
arr(1) = dr.Item("time_IN")
arr(2) = dr.Item("time_OUT")
DataGridView1.Rows.Add(arr)
time1 = dr.Item("time_IN")
time2 = dr.Item("time_OUT")
dr.Dispose()
Catch ex As Exception
MsgBox(ex.Message)
Finally
dr.Dispose()
conn.Close()
End Try
If txtID.Text = "" Then
DataGridView1.Rows.Clear()
txtName.Clear()
txtPosition.Clear()
End If
End If