Last post Apr 20, 2011 01:09 PM by svibuk
Apr 20, 2011 01:09 PM|svibuk|LINK
i hve made a application in vs2005 which has crystal report
in my system i have VS2005 software
crytsal report whetver i needed i hve done it a design time ie added the fields needed during design time
i had placed all the reports in folder knw as reports & had given the path accordingly
when i first executed the app;lication & tried to view the report i got a msg something like " reports cann not be displayed , & needs to be in the bin folder of the application"
so i pasted all the reports frm report folder in bin & now its working
2) i published my application as i wanted to run it on a client system which didnot have VS2005 software
i had just installed teh framework & crystal report MSI file
i deployed the published application along with reports folder
i made necesasry changes in app.config file to specify the client server & database
my application is working fine but when i try to view the reports it showed me a login dialog box which contained the servername, username & password
though in config file i had specified clinet servername it took the server name of my system & asked for password
so after going thr' net i got the above code for deploying crystal report on clinet
Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Dim cryRpt As New ReportDocument
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
.ServerName = ConfigurationManager.AppSettings("ServerName") 'YOUR SERVER NAME"
.DatabaseName = ConfigurationManager.AppSettings("MainData") 'YOUR DATABASE NAME"
.UserID = ConfigurationManager.AppSettings("User_ID") 'YOUR DATABASE USERNAME"
.Password = ConfigurationManager.AppSettings("Password") 'YOUR DATABASE PASSWORD"
Dim ReportName As String = "cons.rpt"
ReportName = Application.StartupPath & "\" & ReportName & ""
Dim ReportForm As CrystalDecisions.CrystalReports.Engine.ReportDocument = New
CrTables = ReportForm.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrystalReportViewer1.ReportSource = ReportForm