Dim In_Total As Integer = 0
Dim Ph_Total As Integer = 0
Dim Day_In_Total As Integer = 0
Dim Day_Ph_Total As Integer = 0
Dim Course_Names1(1) As String
Qry = "SELECT DISTINCT Course_Name,Course_ID FROM Courses WHERE (Course_ID IN (SELECT Course_Id FROM Student_Courses_Pref WHERE student_Id IN (SELECT student_Id FROM Student_Info WHERE Inserted_date >= '" + Now.Month.ToString() + "-1-" + Now.Year.ToString() + "' and Inserted_date <= '" + Now.Date + "' and Branch_Code = '" + BName + "') and Branch_Code = '" + BName + "')) and Branch_Code = '" + BName + "' and Active = 'Y' order by Course_Id"
str = str + "<br> <br> <center><font face ='Verdana' size='+1'><B><U> Summary Report of " + MonthName(Now.Month()).ToString() + "," + Now.Year.ToString() + "</B></U> <br><br>"
com.CommandText = Qry
com.Connection = con
dr = com.ExecuteReader
str = str + "<table align='center' style='FONT-FAMILY: Verdana' bgcolor='#336699' width='100%'>"
str = str + "<tr style='FONT-WEIGHT: bold; FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td align='center' width='3%'> Date </td>"
i = 0
While dr.Read
str = str + "<td align='Center' colspan='2' width='30%'>" + dr(0).ToString() + "</td>"
ReDim Preserve Course_Names1(i)
Course_Names1(i) = dr(1)
i = i + 1
End While
dr.Close()
str = str + "<td colspan ='2'>Total</td></tr>"
For i = 0 To Now.Day
If i = 1 Then
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>st</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
ElseIf i = 2 Then
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>nd</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
ElseIf i = 3 Then
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>rd</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
Else
str = str + "<tr style='FONT-SIZE: x-small;FONT-FAMILY: Verdana' bgColor='#b9ceee'><td>" + i.ToString() + "<sup>th</sup>" + MonthName(Now.Month()).Substring(0, 3) + "</td>"
End If
Qry = ""
For j = 0 To Course_Names1.Length - 1 'Here i got the error
Qry = "select count(student_id),enquiry_by from student_info where inserted_date = '" + MonthName(Now.Month).ToString() + " " + i.ToString() + "," + Now.Year.ToString() + "' and student_id in (select student_id from student_courses_pref where branch_code = '" + BName + "' and Course_id = '" + Course_Names1(j).ToString() + "') and branch_code ='" + BName + "' group by Enquiry_By "
com.CommandText = Qry
dr = com.ExecuteReader
While dr.Read()
If dr.HasRows Then
If UCase(dr(1).ToString()) = "I" Then
'str = str + "<td width='15%' bgcolor='#ffffff'>" + dr(0).ToString() + "</td><td width='15%' bgcolor='#c2ffc8'></td>"
In_Total += dr(0)
ElseIf UCase(dr(1).ToString()) = "P" Then
'str = str + "<td width='15%'bgcolor='#ffffff'></td><td width='15%' bgcolor='#c2ffc8'>" + dr(0).ToString() + "</td>"
Ph_Total += dr(0)
End If
Else
'str = str + "<td width='15%' bgcolor='#ffffff'></td><td width='15%' bgcolor='#c2ffc8'></td>"
End If
End While
If In_Total <> 0 Then
str = str + "<td width='15%' bgcolor='#ffffff'>" + In_Total.ToString() + "</td>"
Else
str = str + "<td width='15%' bgcolor='#ffffff'> </td>"
End If
If Ph_Total <> 0 Then
str = str + "<td width='15%' bgcolor='#c2ffc8'>" + Ph_Total.ToString() + "</td>"
Else
str = str + "<td width='15%' bgcolor='#c2ffc8'> </td>"
End If
dr.Close()
Day_In_Total += In_Total
Day_Ph_Total += Ph_Total
In_Total = 0
Ph_Total = 0
Next
str = str + "<td>" + Day_In_Total.ToString() + "</td><td>" + Day_Ph_Total.ToString() + "</td></tr>"
Day_In_Total = 0
Day_Ph_Total = 0
Next
str = str + "</tr></table>"
答案 0 :(得分:0)
在哪里定义?
是用Dim str as string=""
???
str = str + "<br> <br>...