This is my code it work perfectly bit now i want to calculate total hour so how can i do that with my this code
Public Function GetgiveAtd() As DataTable
Dim con As New SqlConnection(GetConnectionString())
'let we fixed that user go out 3 times maximum
Dim dtAtd As New DataTable()
Dim adp As New SqlDataAdapter("select DISTINCT ER.EmplID,ER.EmplName,AR.RecDate from HrEmployee ER,AtdRecord AR where ER.EmplID=AR.EmplID and ER.EmplID='" + dd1.SelectedValue + "' and RecDate between '" & TextBox2.Text & "' and '" & TextBox3.Text & "'", con)
adp.Fill(dtAtd)
For i As Integer = 1 To 6
Dim clm As New DataColumn()
If i Mod 2 = 0 Then
clm.ColumnName = "empout" & (i \ 2)
Else
clm.ColumnName = "empin" & (i \ 2 + 1)
End If
dtAtd.Columns.Add(clm)
Next
Dim rd As SqlDataReader
For Each dr As DataRow In dtAtd.Rows
Dim sqlCmd As New SqlCommand("select top 10 RecTime from AtdRecord where EmplID= '" & dr(0).ToString() & "' and RecDate='" & dr(2).ToString() & "'", con)
con.Open()
rd = sqlCmd.ExecuteReader()
Dim i As Integer = 3
While rd.Read()
dr(i) = rd(0)
i += 1
End While
con.Close()
Next
Return dtAtd
End Function