Ananda Posted September 9, 2004 Posted September 9, 2004 Hello We have developed a report in crystal that connects with our local database. After development we want to deploy the same to our clients with different data source configuration. Presently we are taking each report file and configuring the client database by replacing the existing data source. How can we achieve this programmatically thru VB.NET? Thanks & Regards Ananda Quote
pendragon Posted September 9, 2004 Posted September 9, 2004 This is how I do it crReportDocument.Database.Tables[0].SetDataSource(your_datasource); Quote
Ananda Posted September 15, 2004 Author Posted September 15, 2004 Invalid report source Hello Thanks for your information. When I execute the following code I am getting invalid report source error. --------------------------------------------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim myreport As New ReportDocument() Dim logoninfo As New TableLogOnInfo() Dim i As Integer myreport.Load("c:\temp\industry.rpt") For i = 0 To myreport.Database.Tables.Count - 1 ' Set the connection information for current table. logoninfo.ConnectionInfo.ServerName = "staffing" logoninfo.ConnectionInfo.DatabaseName = "ir" logoninfo.ConnectionInfo.UserID = "prman" logoninfo.ConnectionInfo.Password = "prman123" myreport.Database.Tables.Item(i).ApplyLogOnInfo(logoninfo) Next i '---------------------------------------------------------------------- CrystalReportViewer1.ReportSource = myreport CrystalReportViewer1.DisplayGroupTree = False End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.