Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 20th, 2003, 04:32 PM
Registered User
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CR in ASP.NET (C#) ... what's wrong??

does anything standout?? I get invalid login ...

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web.Design;

namespace MerPortfolio
    public class DailyReport : System.Web.UI.Page
        protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
        protected System.Web.UI.HtmlControls.HtmlTable Table1;

        private void Page_Load(object sender, System.EventArgs e)


        #region Web Form Designer generated code

        override protected void OnInit(EventArgs e)

            CrystalReportViewer1.ReportSource = this.prepareReport();

        private void InitializeComponent()
            this.Load += new System.EventHandler(this.Page_Load);

        private ReportDocument prepareReport()
            ReportDocument crReportDocument;
            ConnectionInfo crConnectionInfo;
            Database crDatabase;
            Tables crTables;
            TableLogOnInfo crTableLogOnInfo;
            crReportDocument = new ReportDocument();
            crReportDocument.Load"C:\\Inetpub\\wwwroot\\MerPor tfolio\\DailyReportFile.rpt",CrystalDecisions.Shar ed.OpenReportMethod.OpenReportByTempCopy);
            crDatabase = crReportDocument.Database;
            crTables = crDatabase.Tables;
            crConnectionInfo = new ConnectionInfo();
            crConnectionInfo.ServerName = "SQLServerName";
            crConnectionInfo.DatabaseName = "SQLDatabaseName";
            crConnectionInfo.UserID = "sa";
            crConnectionInfo.Password = "sa's password";
            foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in crTables)
                crTableLogOnInfo = aTable.LogOnInfo;
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
            return crReportDocument;

Old December 15th, 2003, 11:28 AM
Registered User
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Hello PSI.

I'm having similar problem, possibly. I've narrowed it down to the fact that the password is not being set (stays blank) within the ReportDocument object. The ApplyLogOnInfo method sets everything else, but the password stays blank. Someone else posted the same problem at this URL:


Through more digging I found that you may be able to work around this by re-establishing the data source. I found this code, though I think it needs some work:

Dim Report As New Dealer 'Dealer is the name of the crystal report
Dim DealerReg As DataSet = New DataSet()
Me.Cursor = Cursors.WaitCursor
DealerNotReg = get_Dealer_Not_Reg() 'Call up procedure to load
DealerReg dataset
If not DealerNotReg.Tables.Count > 0 Then
' This will reset datasource
Report.Database.Tables(0).SetDataSource(DealerReg. Tables(0))
Msgbox "No Records available for query"
end if
msgbox "Error Loading CR: " & err.number & " - " & err.description
Me.Cursor = Cursors.default
End Try

I'll try to reply back if I find anything more.


Similar Threads
Thread Thread Starter Forum Replies Last Post
CR XI Access System database in asp.net 2.0 rturner003 ASP.NET 2.0 Professional 0 October 22nd, 2007 09:50 AM
Passing CR Login info in a ASP.NET app. billbeecher@cox.net BOOK: Professional Crystal Reports for VS.NET 0 March 31st, 2005 10:23 PM
dynamic image display in CR in asp.net mpkrishna Crystal Reports 0 March 29th, 2005 01:44 AM
Getting started with CR & ASP.NET George H. Crystal Reports 1 May 3rd, 2004 06:22 PM
Porting a sa,ple ASP CR viewer app to ASP.NET jhansen42 Crystal Reports 0 August 29th, 2003 10:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.