I need to make report viewer that will handle reports localy. I got RDL files with querys. Is there a way to insert conenction string into report's XML code so the report can get data from database directly? reports will be display in MS reportViewer.
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition">
<DataSources>
<DataSource Name="BIA">
<DataSourceReference>BIA</DataSourceReference>
<rd:DataSourceID>98fa74a9-d829-4196-be9d-49697ded5201</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="RelItems">
<Fields>
<Field Name="RelItemID">
<DataField>RelItemID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="SSISPackageName">
<DataField>SSISPackageName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>BIA</DataSourceName>
<CommandText>select b.ID as RelItemID, SSISPName --+ ' ('+s.Name + ' -> ' + d.Name + ')'
as SSISPackageName
from dbo.RelTypes_ProvTypes a
inner join dbo.RelItems b on a.RelTypeID = b.RelTypeID
inner join dbo.ObjItems s on b.ObjItemIDSource = s.ID and a.ObjTypeIDSource = s.ObjTypeID
inner join dbo.ObjItems d on b.ObjItemIDDest = d.ID and a.ObjTypeIDDest = d.ObjTypeID
where SSISPName is not null
order by 2</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
</DataSet>
... and so on
This is RDL I have. Any other tips or help is welcome, just need to make it work :)
RDL files contain query information that isn't stored in RDLC files as used the ReportViewer control. If you want to use your RDL file outside of SSRS in the ReportViewer then you can set the datasource property from code when running the report in local mode. That way you set the connection string to whatever you want when you build the datasource.
ReportViewer1.Reset()
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.ReportPath = <yourfilepath>
ReportViewer1.LocalReport.DataSources.Add(<yourdatasource>)
ReportViewer1.LocalReport.Refresh()
(obviously this snippet is VB)