我尝试使用CSharp语言创建水晶报表的代码,我发现一个教训,如何创建一个水晶Replort使用C#在这个网站是什么意思在C尖锐的C#
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;
}
可以请你expline我什么剂量的意思,我怎样可以把它改成我的情况下,由于
这是我不明白
CustomerDS custDB = new CustomerDS();
custDB.Clear();
adap.Fill(custDB, "Customers");
给出的错误是什么? – Prescott
那么它获取一些数据并将其作为'DataSource'分配给你的报告,你能详细说明你不明白的东西吗? – V4Vendetta
你写过上面的代码吗?如果是的话,你怎么能写一些你不明白的东西??还是你复制粘贴一些例子,直到你得到它的工作..? – MethodMan