Hi,
Im using a calendar control and on the dayrender event - I call m
sub, which runs a query and gets a SUM value for each day. Below is th
code
----------------------------------------------------
Public Sub calhours_dayren der(ByVal s As Object, ByVal e A
DayRenderEventA rgs)
Dim calCell As TableCell
Dim DayHours As String
Dim DayDate As Date
Dim Conn As SqlConnection = Ne
SqlConnection(" Server=CHRI_010 01; Initial Catalog=ELY3019 ; uid=mmapp
password=pwd")
DayDate = e.Day.Date
calCell = e.Cell
Dim sqlComm As SqlCommand
Dim sqlDR As SqlDataReader
Conn.Open()
sqlComm = New SqlCommand("Sel ect Convert(int
Sum(Round(Hours ,0))) as Hours From GetHoursForDays ('10314', '"
DayDate & "', '" & DayDate & "')", Conn)
sqlDR = sqlComm.Execute Scalar()
DayHours = CType(sqlDR("Ho urs"), String)
'DayHours = CType(sqlDR(0), String)
Conn.Close()
calCell.Control s.Add(New LiteralControl( "<p><font color=whit
size=1>"))
calCell.Control s.Add(New LiteralControl( DayHours))
End Sub
----------------------------------------------------
I keep getting this error :
Specified cast is not valid.
Description: An unhandled exception occurred during the execution o
the current web request. Please review the stack trace for mor
information about the error and where it originated in the code.
Exception Details: System.InvalidC astException: Specified cast is no
valid.
Source Error:
Line 54: sqlDR = sqlComm.Execute Scalar()
Any ideas ??
ajaymehr
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message390078.htm
Comment