Reputation: 35
I'm trying to find a way to Programmatically change the connection string of an rpt file permanently to a connection that currently doesn't exist. I need to send these rpt reports out to clients who are using a different connection then I am.
I've tried some examples where you load the report and then set the connection with apply logon info, but it seemed to only affect the report at run time and the changes never stayed. I need the rpt file to keep the connection string i set.
Is there an way to do this?
Upvotes: 1
Views: 963
Reputation: 1346
You need to call the method SaveAs of the ReportDocument class.
If you need to change just one file you can use this tool instead of writing your own code: http://www.r-tag.com/Pages/CRDataSource.aspx The free version works for one file without restrictions.
Upvotes: 1