Databases Reference
In-Depth Information
'set the datasources to “reportsdb”
Dim reference As New DataSourceReference
reference.Reference = folderPath & “/” & dataSourceName
Dim items As CatalogItem() = rs.ListChildren(folderPath, False)
For Each item As CatalogItem In items
If item.Type = ItemTypeEnum.Report Then
Dim dataSources As DataSource() = _
rs.GetReportDataSources(item.Path)
For Each dataSource As DataSource In dataSources
dataSource.Item = reference
Next
rs.SetReportDataSources(item.Path, dataSources)
Console.WriteLine(item.Name & “ datasource was updated”)
End If
Next
End Sub
These are the helper functions that provide string parsing and mime type checking:
Private Function GetShortFileName(ByVal fullFileName As String) As String
'get the report name
Dim slashPos As Integer = fullFileName.LastIndexOf(“\”)
Dim dotPos As Integer = fullFileName.LastIndexOf(“.”)
Dim retVal As String = fullFileName.Substring _
(slashPos + 1, dotPos - slashPos - 1)
Return retVal
End Function
Private Function GetExtension(ByVal fullFileName As String) As String
Dim retVal As String = fullFileName.Substring _
(fullFileName.LastIndexOf(“.”) + 1)
Return retVal
End Function
Private Function GetMimetype(ByVal fullFileName As String) As String
Dim extension As String = GetExtension(fullFileName)
Dim retVal As String
Select Case extension
Case “htm”
retVal = “text/html”
Case “html”
retVal = “text/html”
Case “xml”
retVal = “text/xml”
Case “csv”
retVal = “text/plain”
Case “tif”
retVal = “image/tif”
Case “tiff”
retVal = “image/tif”
Search WWH ::




Custom Search