【发布时间】:2012-12-15 09:38:35
【问题描述】:
我正在尝试使用 Csharp 语言创建 Crystal Report,我在本网站上找到了如何使用 C# 创建 Crystal Replrt 的课程
http://www.codeproject.com/Articles/14029/How-to-Create-a-Crystal-Report-using-C-and-MySQL
但是当我尝试理解代码时,我不理解某些行以及如何将其更新到我的情况
完整的按钮代码
private void button2_Click(object sender, EventArgs e)
{
Mydb mysqlclass = new Mydb();
mysqlclass.conncting();
// here is error under fahad.conncting.createcommand();
MySqlCommand cmd = mysqlclass.connection.CreateCommand();
cmd.CommandText = "SELECT * FROM admin ";
mysqlclass.connection.Open();
MySqlDataAdapter adap = new MySqlDataAdapter(cmd);
MySqlDataReader dataReader = cmd.ExecuteReader();
// Create a Dataset and using DataAdapter to fill it
adap = new MySqlDataAdapter();
adap.SelectCommand = cmd;
CustomerDS custDB = new CustomerDS();
custDB.Clear();
adap.Fill(custDB, "Customers");
// Create a CrystalReport1 object
CrystalReport1 myReport = new CrystalReport1();
// Set the DataSource of the report
myReport.SetDataSource(custDB);
// Set the Report Source to ReportView
crystalReportViewer1.ReportSource = myReport;
}
你能解释一下这意味着什么剂量以及我如何改变它以适应我的情况,谢谢
这是我不明白的
CustomerDS custDB = new CustomerDS();
custDB.Clear();
adap.Fill(custDB, "Customers");
【问题讨论】:
-
给出的错误是什么?
-
它获取一些数据并将其分配为
DataSource用于您的报告,您能详细说明您不了解的地方吗? -
上面的代码是你写的吗?如果是这样,你怎么能写一些你不明白的东西..?还是你复制粘贴了一些例子直到你让它工作..?
标签: c# mysql crystal-reports