Good morning! I am attempting to create a timelog for a current project, I need to somehow assign a value to the variable 'depart' from a dataview that I've pulled. I'm sorry if this is like another question but I couldn't seem to find something to help my answer. Please note: depart, firstDate, etc. are all declared already.
dataview = dba.Query("SELECT Time, Status FROM Timelog WHERE [Date] = '" & firstDate & "' AND USERNAME LIKE '" & AgentList.SelectedValue & "' ")
For Each rowView AS DataRowView in dataview
DIM row as DataRow = rowView.Row
If dataview.Find("Departed") Then
depart = dataview.Find("time"
End If
Next
I plan on using the DateDiff function to calculate the hours between a departure and return from lunch, and then lunch and arrival.
I have no idea what dba.Query() returns but I assume it is some type of collection, based on the fact you are iterating through it on the next line. Because of that, dataview.find() would NOT be returning a value from a row, but more like the index of the column that has that name.
What you need to do is get the value of the field for the current row of your iteration:
depart = rowView("Time")