Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9233

Database login prompts continuously - CR 2012 for .net/win 7&8/SQL Server /OLEDB

$
0
0

I looked at the forum but none of the steps is not resolving my problem. I have a very simple report connected to SQL Server 2012. When i try to run the report i am getting database prompt. Here is my code

 

public partial class CrystalForm : System.Web.UI.Page

    {

        ReportDocument rpt;

        protected void Page_Load(object sender, EventArgs e)

        {

        }

 

 

                            override protected void OnInit(EventArgs e)

                    {

                              //

                              // CODEGEN: This call is required by the ASP.NET Web Form Designer.

                              //

                              InitializeComponent();

                              ConfigureCrystalReports();

                              base.OnInit(e);

                    }

 

                    /// <summary>

                    /// Required method for Designer support - do not modify

                    /// the contents of this method with the code editor.

                    /// </summary>

                    private void InitializeComponent()

                    {   

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

 

 

                    }

 

 

                    private void ConfigureCrystalReports()

                    {

            ReportDocument rpt = new ReportDocument();

            ArrayList al=new ArrayList();

            try

            {

                rpt.Load(Server.MapPath(@"MatchDetail.rpt"),OpenReportMethod.OpenReportByTempCopy);

                ConnectionInfo connectionInfo = new ConnectionInfo();

                connectionInfo.ServerName = "s09.winhost.com";

                connectionInfo.DatabaseName = "DB_54980_njsluggers_user";

                connectionInfo.UserID = "DB_54980_njsluggers";

                connectionInfo.Password = "Network01";

                SetDBLogonForReport(connectionInfo, rpt);

                CrystalReportViewer1.ReportSource = rpt;

               

\

            }

            catch (Exception)

            {

               

                throw;

            }

                       

 

 

 

                    }

        private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)

        {

            Tables tables = reportDocument.Database.Tables;

            foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)

            {

                TableLogOnInfo tableLogonInfo = table.LogOnInfo;

                tableLogonInfo.ConnectionInfo = connectionInfo;

                table.ApplyLogOnInfo(tableLogonInfo);

            }

        }

 

 

    }


Viewing all articles
Browse latest Browse all 9233

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>