Click here to Skip to main content
15,886,844 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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?
Posted
Updated 7-Aug-10 4:12am
v2

try this in your code behind

on page_load

add this
VB
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;)
rd.SetDataSource(dt)
 
Share this answer
 
v2
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 ....
 
Share this answer
 
Hi all,
Also i have face this problem but i resolve with following way you can try it
Code:
C#
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
            Cr.SetDataSource(dtD);
            crystalReportViewer1.ReportSource = Cr;
}

i think it will help.
Regards
Arjun Choubey
 
Share this answer
 
v4
Comments
Amira El-Baroudy 26-May-15 9:02am    
I am using crystal reports for visual studio 2012 in an asp.net 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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900