Quantcast
Viewing all articles
Browse latest Browse all 3636

Database login dialog popup when the project is x64

I created a c# winform project, drag and drog "CrystalReportViewer" from toolbox to the form, and in the InitializeComponent() method, write code like below, and "Category Overview.rpt" file connect db is OLE DB(ADO), see "connect db.png" :

    private void InitializeComponent()
    {

            this.crystalReportViewer1 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();

            this.SuspendLayout();

 

            //

            // crystalReportViewer1

            //

            string reportName = "C:\\E\\Report\\DaoToAdo\\Test5\\Category Overview.rpt";

            string path = "C:\\E\\Report\\DaoToAdo\\Test5\\Model1 - Copy - Copy.accdb";

 

 

            ReportDocument reportDocument = new ReportDocument();

            // Specify the path to the report we want to print.

            reportDocument.FileName = reportName;

            // Tell it where the database is.

            Database database = reportDocument.Database;

            Tables databaseTables = database.Tables;

            ConnectionInfo connectionInfo = new ConnectionInfo();

            connectionInfo.ServerName = path;

 

            Table databaseTable = databaseTables[0];

            TableLogOnInfo tableLogonInfo = databaseTable.LogOnInfo;

            tableLogonInfo.ConnectionInfo = connectionInfo;

            databaseTable.ApplyLogOnInfo(tableLogonInfo);

 

            this.crystalReportViewer1.RefreshReport();

            this.crystalReportViewer1.ActiveViewIndex = -1;

            this.crystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;

            this.crystalReportViewer1.Cursor = System.Windows.Forms.Cursors.Default;

            this.crystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill;

            this.crystalReportViewer1.Location = new System.Drawing.Point(0, 0);

            this.crystalReportViewer1.Name = "crystalReportViewer1";

            this.crystalReportViewer1.Size = new System.Drawing.Size(724, 565);

            this.crystalReportViewer1.TabIndex = 0;

            this.crystalReportViewer1.ReportSource = reportDocument;

            //

            // Form1

            //

            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(724, 565);

            this.Controls.Add(this.crystalReportViewer1);

            this.Name = "Form1";

            this.Text = "Form1";

            this.ResumeLayout(false);

          }

 

Run the project in 32bit, it works well.

 

Run the project in 64bit, it will popup an database login dialog. what's wrong with it (database login dialog.png)?


Viewing all articles
Browse latest Browse all 3636

Trending Articles



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