我有一个表有字段Empid,RecTime,EmpId,Recdate。
这是代码: s =“选择e.EmpName,a.EmpId,a.WorkID,a.RecDate,a.RecTime来自HrEmployee e,AtdRecord a a aEmpId = e.EmpId and 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