Click here to Skip to main content
14,668,708 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have prepared Crystal report.
While loading file, I passed the login information(server name, db name etc). But, when crystal report loads on the server, it asks for login information when displayed in browser.

Please suggest me?
Updated 7-Aug-10 4:12am

Rate this:
Please Sign up or sign in to vote.

Solution 1

try this in your code behind

on page_load

add this
Dim rd As ReportDocument
rd = New ReportDocument
rd.Load(Server.MapPath("Reports/CrystalReport2.rpt")) 'path to your rpt file

'sql stuff i am using a datatable
Dim dt As DataTable = DataAdaptor.GetDataTable(sql)
dt.TableName = "yourtable"

rd.SetDatabaseLogon(dbloginname;, dbpassword;)
Rate this:
Please Sign up or sign in to vote.

Solution 4

try that open field explorer---> database field --->Right Click -->current Data source --->reports connection----->report ----->property ----> set Property as---

Data Source: .\Databasename.accdb

and code on viewer form load as

Dim cryRpt As New ReportDocument

Dim Report1 As New rptItemWise

Dim strServerName As String
strServerName = Application.StartupPath
rptItemWise.SetDatabaseLogon("admin", "", strServerName, "dastabasename.accdb", True)

cryRpt.Load(Application.StartupPath + "\rptItemWise.rpt")

also change the report connection same as data source i think that code work for you ....
Rate this:
Please Sign up or sign in to vote.

Solution 3

Hi all,
Also i have face this problem but i resolve with following way you can try it
private void MYReport_Load(object sender, EventArgs e)

            GenericDAL Gd = new GenericDAL();
            string error = string.Empty;
            int id = 1;
            DataSet ds = Gd.GetGetStudentData(out error, id);//My SQL stattement
            DataTable dtD = ds.Tables[0];
            CrMain Cr = new CrMain();//crystalreport name
            Cr.SetDatabaseLogon("developer", "Arjun");//Userid and password
            crystalReportViewer1.ReportSource = Cr;

i think it will help.
Arjun Choubey
Amira El-Baroudy 26-May-15 9:02am
I am using crystal reports for visual studio 2012 in an application, i have tried all solutions and I need urgently workaround for that logon screen. I have made a new report and a new dataset with only one table and wanted the report to view. Any clue ?? Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100