01.
Dim
sql
As
String
02.
sql =
"SELECT tbl_DailyRecord.LabourID, tbl_DailyRecord.Nameeng, tbl_DailyRecord.Dates, tbl_DailyRecord.TimeIn, tbl_DailyRecord.TimeOut, tbl_DailyRecord.Hours FROM tbl_DailyRecord"
03.
If
CheckBox1.Checked
Then
04.
Dim
a
As
String
= DateTimePicker1.Value
05.
Dim
b
As
String
= DateTimePicker2.Value
06.
07.
sql =
" Where tbl_DailyRecord.Dates between #"
& a &
"# AND tbl_DailyRecord.Dates #"
& b &
"#"
08.
End
If
09.
sql &=
" order by tbl_DailyRecord.LabourID"
10.
da =
New
OleDbDataAdapter(sql, conn)
11.
ds =
New
DataSet
12.
da.Fill(ds,
"labour"
)
13.
DataGridView1.Rows.Clear()
14.
If
ds.Tables(0).Rows.Count <> 0
Then
15.
For
i = 0
To
ds.Tables(0).Rows.Count - 1
16.
DataGridView1.Rows.Add()
17.
DataGridView1.Rows(i).Cells(
"LabourID"
).Value = ds.Tables(0).Rows(i).Item(
"LabourID"
).ToString
18.
DataGridView1.Rows(i).Cells(
"Nameeng"
).Value = ds.Tables(0).Rows(i).Item(
"Nameeng"
).ToString
19.
DataGridView1.Rows(i).Cells(
"Dates"
).Value = ds.Tables(0).Rows(i).Item(
"Dates"
)
20.
DataGridView1.Rows(i).Cells(
"TimeIn"
).Value = ds.Tables(0).Rows(i).Item(
"TimeIn"
)
21.
DataGridView1.Rows(i).Cells(
"TimeOut"
).Value = ds.Tables(0).Rows(i).Item(
"TimeOut"
)
22.
DataGridView1.Rows(i).Cells(
"Hours"
).Value = ds.Tables(0).Rows(i).Item(
"Hours"
)
23.
Next
24.
End
If