Question not able to get report , asking login credentials

svibuk

Active member
Joined
Jul 15, 2008
Messages
31
Programming Experience
1-3
i hve made a application in vs2005(frame work 2.0 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

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



code

Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
CrystalReportViewer1.Load

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


With crConnectionInfo

.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"

End With

Dim ReportName As String = "cons.rpt"

ReportName = Application.StartupPath & "\" & ReportName & ""

Dim ReportForm As CrystalDecisions.CrystalReports.Engine.ReportDocument = New
CrystalDecisions.CrystalReports.Engine.ReportDocument

ReportForm.Load(ReportName)

CrTables = ReportForm.Database.Tables

For Each CrTable In CrTables

crtableLogoninfo = CrTable.LogOnInfo

crtableLogoninfo.ConnectionInfo = crConnectionInfo

CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next

CrystalReportViewer1.ReportSource = ReportForm

CrystalReportViewer1.Refresh()

End Sub
 
Back
Top