View Single Post
 
Old November 20th, 2003, 04:32 PM
psinyc psinyc is offline
Registered User
 
Join Date: Jun 2003
Location: , , .
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)

        {
            InitializeComponent();
            CrystalReportViewer1.ReportSource = this.prepareReport();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
        }
        #endregion

        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;
                aTable.ApplyLogOnInfo(crTableLogOnInfo);
            }
            return crReportDocument;
        }
    }
}

thanks,
psi