COMException在vb.net中未处理

时间:2016-03-25 08:00:16

标签: vb.net crystal-reports

我想将texbox1值传递给crystal report。 Form1有一个button1和一个textbox1,当我点击Mytextbox时,form2会在其上加载水晶报告并显示我放在 Report.SetParameterValue("MyTextBox", Form1.TextBox1.Text) 上的数据。我已经创建了参数字段Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class Form2 Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load Dim Report As New ReportDocument Report.Load("C:\users\agent_edx44\Documents\Visual studio 2012\projects\sample\sample\sample.rpt") Report.SetParameterValue("MyTextBox", Form1.TextBox1.Text) CrystalReportViewer1.ReportSource = Report CrystalReportViewer1.Refresh() End Sub End Class 并放入crystalreport。当我运行我的程序时说

  

COMExceptions未处理

在这一行

// This line of code is generated by Data Source Configuration Wizard
// Instantiate a new DBContext
WindowsFormsApplication2.CountriesDBEntities dbContext = new WindowsFormsApplication2.CountriesDBEntities();
// Call the Load method to get the data for the given DbSet from the database.
dbContext.Countries.Load();
// This line of code is generated by Data Source Configuration Wizard
gridLookUpEdit1.Properties.DataSource = dbContext.Countries.Local.ToBindingList();

enter image description here

Vb.net代码

dbContext.Countries.Where(c => c.Capital.StartsWith("A")).Load();

0 个答案:

没有答案