У меня есть одна таблица с полями Empid, RecTime, EmpId, Recdate.
Вот код: s = "Выберите e.EmpName, a.EmpId, a.WorkID, a.RecDate, a.RecTime из HrEmployee e, AtdRecord a, где a.EmpId = e.EmpId и EmpName = '"& TextBox1.Text &"' и RecDate между '"& TextBox2.Text &"' и '"& TextBox3.Text &"' "
cmd = New SqlCommand(s, conn)
cmd.ExecuteNonQuery()
da = New SqlDataAdapter(s, conn)
'ds = New DataSet 'da.Fill(ds)
dt = New DataTable()
da.Fill(dt)
dc1 = New DataColumn("InTime") ' make column InTime and OutTime
dc2 = New DataColumn("OutTime")
dt.Columns.Add(dc1)
dt.Columns.Add(dc2)
'For entering data from database col to datatable (Intime,Outtime)
For Each dr In dt.Rows
i = 4
mystring = dr(i)
timestring = dt.Rows.IndexOf(dr)
If timestring Mod 2 = 0 Then
j = 5
dr(j) = mystring
Else
k = 6
dr("OutTime") = mystring
End If
Next
For Each col In dt.Columns
bfield = New BoundField
bfield.DataField = col.ColumnName
bfield.HeaderText = col.ColumnName
'GridView1.Columns.Add(bfield)
Next
GridView1.DataSource = dt
GridView1.DataBind()
conn.Close()
Я хочу знать, как я могу получить значения в этом сценарии из RecTime:
InTime Outtime
8 9
1:30 2:45
Когда RecTime:
8
9
1:30
2:45