问题描述
Icreatedac#winformproject,draganddrog"CrystalReportViewer"fromtoolboxtotheform,andintheInitializeComponent()method,writecodelikebelow,and"CategoryOverview.rpt"fileconnectdbisOLEDB(ADO)():privatevoidInitializeComponent(){this.crystalReportViewer1=newCrystalDecisions.Windows.Forms.CrystalReportViewer();this.SuspendLayout();////crystalReportViewer1//stringreportName="C:\E\Report\DaoToAdo\Test5\CategoryOverview.rpt";stringpath="C:\E\Report\DaoToAdo\Test5\Model1-Copy-Copy.accdb";//Model1-Copy-Copy.accdbReportDocumentreportDocument=newReportDocument();//Specifythepathtothereportwewanttoprint.reportDocument.FileName=reportName;//Tellitwherethedatabaseis.Databasedatabase=reportDocument.Database;TablesdatabaseTables=database.Tables;ConnectionInfoconnectionInfo=newConnectionInfo();connectionInfo.ServerName=path;TabledatabaseTable=databaseTables[0];TableLogOnInfotableLogonInfo=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=newSystem.Drawing.Point(0,0);this.crystalReportViewer1.Name="crystalReportViewer1";this.crystalReportViewer1.Size=newSystem.Drawing.Size(724,565);this.crystalReportViewer1.TabIndex=0;this.crystalReportViewer1.ReportSource=reportDocument;////Form1//this.AutoScaleDimensions=newSystem.Drawing.SizeF(8F,16F);this.AutoScaleMode=System.Windows.Forms.AutoScaleMode.Font;this.ClientSize=newSystem.Drawing.Size(724,565);this.Controls.Add(this.crystalReportViewer1);this.Name="Form1";this.Text="Form1";this.ResumeLayout(false);}Runtheprojectin32bit,itworkswell.Runtheprojectin64bit,itwillpopupadatabaselogindialog.what'swrongwith)?
解决方案
解决方案二:
Youwouldneedthe64-bitCrystalRuntime
解决方案三:
我用的就是64-bit的CrystalRuntime呢