moc2469
Active member
- Joined
- Jun 21, 2007
- Messages
- 27
- Programming Experience
- 1-3
I am programming an app. that will be used to do Scheduling for employees. I am trying to fill a dynamic table on the page based on the returned dataset. I can display the first person and their associated times, but I get nothing for the rest.
Any Ideas????????
VB.NET:
Public Function Setup_Page(ByVal myDS As DataSet)
'Set var for dataset
ds = myDS 'This is Public.....
'Var used in For loop
Dim x, i As Int32
'Find number of employees to print on schedule
iCount = ds.Tables(0).Rows.Count / 7 'Becaue each entry is name, starttime, endtime, date
'Page Title
Response.Write("<table>")
Response.Write("<tr><td style='FONT-SIZE: 24pt'><b>Company's Name</b></td>")
Response.Write("<td width='150'></td>")
Response.Write("<td style='FONT-SIZE: 18pt' colspan='2' align='center'><b>WEEKLY WORK SCHEDULE</b></td></tr>")
Response.Write("<tr><td width='250'></td><td width='150'></td>")
Response.Write("<td style='FONT-SIZE: 18pt' width='150'><b>Store: " & sStore & "</b></td>")
Response.Write("<td style='FONT-SIZE: 18pt'><b>Week Ending: " & sTo & "</b></td></tr>")
Response.Write("</table>")
Dim dayOfWeek1, dayOfWeek2, dayOfWeek3, dayOfWeek4, dayOfWeek5, dayOfWeek6, dayOfWeek7 As Date
Dim sdayOfWeek1, sdayOfWeek2, sdayOfWeek3, sdayOfWeek4, sdayOfWeek5, sdayOfWeek6, sdayOfWeek7 As String
dayOfWeek1 = ds.Tables(0).Rows(x).Item("e_DATE")
sdayOfWeek1 = dayOfWeek1.AddDays(0).DayOfWeek.ToString()
dayOfWeek2 = ds.Tables(0).Rows(x + 1).Item("e_DATE")
sdayOfWeek2 = dayOfWeek2.AddDays(0).DayOfWeek.ToString()
dayOfWeek3 = ds.Tables(0).Rows(x + 2).Item("e_DATE")
sdayOfWeek3 = dayOfWeek3.AddDays(0).DayOfWeek.ToString()
dayOfWeek4 = ds.Tables(0).Rows(x + 3).Item("e_DATE")
sdayOfWeek4 = dayOfWeek4.AddDays(0).DayOfWeek.ToString()
dayOfWeek5 = ds.Tables(0).Rows(x + 4).Item("e_DATE")
sdayOfWeek5 = dayOfWeek5.AddDays(0).DayOfWeek.ToString()
dayOfWeek6 = ds.Tables(0).Rows(x + 5).Item("e_DATE")
sdayOfWeek6 = dayOfWeek6.AddDays(0).DayOfWeek.ToString()
dayOfWeek7 = ds.Tables(0).Rows(x + 6).Item("e_DATE")
sdayOfWeek7 = dayOfWeek7.AddDays(0).DayOfWeek.ToString()
'Create as many rows as needed then populate them
Dim sName As String
sName = ds.Tables(0).Rows(x).Item("e_EMPLOYEE")
'Header Table
Response.Write("<table id='myTable'" & x & " style='FONT-SIZE: 12pt'>")
Response.Write("<tr><td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='200'><b>Name: " & sName & "</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'><b>" & sdayOfWeek1 & "</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'><b>" & sdayOfWeek2 & "</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'><b>" & sdayOfWeek3 & "</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'><b>" & sdayOfWeek4 & "</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'><b>" & sdayOfWeek5 & "</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'><b>" & sdayOfWeek6 & "</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'><b>" & sdayOfWeek7 & "</b></td></tr>")
Response.Write("</table>")
'Set first row, first cell
Dim row1 As DateTime = ds.Tables(0).Rows(0).Item("e_START")
row1 = row1.ToShortTimeString()
'Body Table
Response.Write("<table id='dataTable'" & x & " style='FONT-SIZE: 12pt'>")
Response.Write("<tr><td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='200' align='right'>")
Response.Write("<b>Start:</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'>")
Response.Write(row1 & "</td>")
'Seven days in the week
For x = 1 To 7
If ds.Tables(0).Rows(x).Item("e_EMPLOYEE") = ds.Tables(0).Rows(x - 1).Item("e_EMPLOYEE") Then
Dim sTime1 As DateTime
sTime1 = ds.Tables(0).Rows(x).Item("e_START")
sTime1 = sTime1.ToShortTimeString()
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'>")
Response.Write(sTime1 & "</td>")
End If
Next x
Response.Write("</tr>")
'Set second row, cell 1
Dim row2 As DateTime = ds.Tables(0).Rows(0).Item("e_FINISH")
row2 = row2.ToShortTimeString()
'Next Row
Response.Write("<tr><td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='200' align='right'>")
Response.Write("<b>Finish:</b></td>")
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'>")
Response.Write(row2 & "</td>")
'Seven days in the week
For x = 1 To 7
If ds.Tables(0).Rows(x).Item("e_EMPLOYEE") = ds.Tables(0).Rows(x - 1).Item("e_EMPLOYEE") Then
Dim sEnd1 As DateTime
sEnd1 = ds.Tables(0).Rows(x).Item("e_FINISH")
sEnd1 = sEnd1.ToShortTimeString()
Response.Write("<td style='BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid' width='100' align='center'>")
Response.Write(sEnd1 & "</td>")
End If
Next x
Response.Write("</tr></table>")
End Function
Any Ideas????????
Last edited by a moderator: