hi,
when i try to run the project provided in the samples provided with the
.net sdk i am getting an error
Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
Line 189: Dim myInfoObject As InfoObject
Line 190: For Each myInfoObject In myInfoObjects
Line 191: Dim myReport As Report = CType(myInfoObject, Report)
Line 192: ’ Dim myReport As Report = CType(myInfoObject, Report)
Line 193: Dim siUpdateTs As [Property] = myReport.Properties(“SI_UPDATE_TS”)
The code
Dim myDataTable As DataTable = New DataTable()
myDataTable.Columns.Add(New DataColumn(“URL”))
myDataTable.Columns.Add(New DataColumn(“Name”))
myDataTable.Columns.Add(New DataColumn(“Description”))
myDataTable.Columns.Add(New DataColumn(“LastModified”))
Dim query As String = "Select SI_NAME, SI_ID, SI_DESCRIPTION, SI_UPDATE_TS " _
& "From CI_INFOOBJECTS Where SI_KIND=" _
& "'Webi' And SI_INSTANCE=0 " _
& "And SI_PARENT_FOLDER=" & parentID
Dim myInfoObjects As InfoObjects = myInfoStore.Query(query)
'Dim myInfoObjects As InfoObjects = myInfoStore.Query(query)
'Dim a As Int16
'' a = myInfoObjects.Count
If myInfoObjects.Count > 0 Then
Dim myInfoObject As InfoObject
For Each myInfoObject In myInfoObjects
Dim myReport As Report = CType(myInfoObject, Report)
' Dim myReport As Report = CType(myInfoObject, Report)
Dim siUpdateTs As [Property] = myReport.Properties("SI_UPDATE_TS")
Dim myDataRow As DataRow = myDataTable.NewRow()
myDataRow("URL") = "ReportDescription.aspx?reportID=" _
& myReport.ID.ToString() _
& "&folderID=" & parentID
myDataRow("Name") = myReport.Title
myDataRow("Description") = myReport.Description
myDataRow("LastModified") = Convert.ToString(siUpdateTs.Value)
myDataTable.Rows.Add(myDataRow)
Next
Else
Dim myDataRow As DataRow = myDataTable.NewRow()
myDataRow("URL") = ""
myDataRow("Name") = "No Reports found."
myDataRow("Description") = ""
myDataRow("LastModified") = ""
myDataTable.Rows.Add(myDataRow)
End If
Return myDataTable
End Function
end code
Any idea why this is happening?
Thanks
Prady
prady (BOB member since 2005-06-21)