jweddington001
New member
- Joined
- Dec 9, 2011
- Messages
- 2
- Programming Experience
- 1-3
I have an employee timekeeping program that I am writing.I have a listview that contains nine columns. They pull the data via SELECT statement from multiple tables in SQL. I have one table called Overtime that contains a column with overtime codes specific to the employees overtime record The overtime table has a otdate column that contains the date that the overtime data was entered. My problem is that when the user of the program wants to select a date range for an employee from the form, it will properly display the information except that it doesn't match up the overtime code with the date that it was entered on. It runs down the column for all dates and I would like it to just show up on the date that it was entered. Any assistance is grealty appreciated.
The Table:
The Program at Runtime:
The Code:
The Table:
The Program at Runtime:
The Code:
VB.NET:
Protected Sub BindRank()
pwschedulelb.Items.Clear()
Dim otcomm As New SqlCommand
otcomm.Connection = otconn
Dim read As SqlDataReader
otcomm.CommandText = "SELECT Rank.squad, Cal.dt, Cal.dayname, MasterName.shift, Shift.starttime, Shift.endtime, Rank.title, Shift.total, Overtime.Code From Rank, Cal, MasterName, Shift, Overtime WHERE Cal.dt BETWEEN '" & (DatePickerFrom.Text) & "' AND '" & (DatePickerTo.Text) & "' and MasterName.empno = '" & empnotb.Text & "' and MasterName.empno = Rank.empno and MasterName.shift = Shift.shiftno and MasterName.empno = Overtime.empno"
otcomm.Connection.Open()
read = otcomm.ExecuteReader
Dim intCount As Decimal = 0
Do While read.Read
pwschedulelb.Items.Add(Trim(NNL(read("squad"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(read("dt"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(read("dayname"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(read("shift"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(Format(read("starttime"), "HH:mm"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(Format(read("endtime"), "HH:mm"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(read("title"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(read("total"))))
pwschedulelb.Items(CInt(intCount)).SubItems.Add(Trim(NNL(read("Code"))))
intCount = intCount + 1
Loop
read.Close()
otcomm.Connection.Close()
pwschedulelb.Refresh()
End Sub
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]
[/SIZE][/FONT][/SIZE][/FONT]