Мне нужно создать хрустальный отчет, данные которого будут заполнены из набора данных. Набор данных имеет три типа данных. А именно:Использовать несколько Datatable в наборе данных
CustDetais
BookingDetails
FoodNExtra
Когда кристалл отчет Настройка с помощью мастера отчетов Crystal, я получил новый экран, который говорит Не уверен, что делать здесь, так что я просто щелкнул дальше. И мой Heres код для просмотра Crystal Report:
private void CRKOTQoute_Load(object sender, EventArgs e)
{
try
{
MySqlCommand cmd = new MySqlCommand("select CustName,Phone,Address,Email from tblCustDetails where [email protected]", con.con);
cmd.Parameters.AddWithValue("@custid", BLDashboard.custid);
MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
DataSet1 ds = new DataSet1();
adapter.Fill(ds, "CustDetais");
if (ds.Tables["CustDetais"].Rows.Count == 0)
{
MessageBox.Show("No Data Found", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
MySqlCommand cmd1 = new MySqlCommand("select BookingID,BookingDate,Event,EventDate,EventTime,Pax,Service,ServiceTime from tblBookingDetails where [email protected]", con.con);
cmd.Parameters.AddWithValue("@bookid", BLDashboard.bookingID);
MySqlDataAdapter adapter1 = new MySqlDataAdapter(cmd1);
DataSet1 ds1 = new DataSet1();
adapter.Fill(ds1, "BookingDetails");
if (ds1.Tables["BookingDetails"].Rows.Count == 0)
{
MessageBox.Show("No Data Found", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
MySqlCommand cmd2 = new MySqlCommand("select FoodMenu,ExtraItem from tblItem where [email protected]", con.con);
cmd.Parameters.AddWithValue("@bookid1", BLDashboard.bookingID);
MySqlDataAdapter adapter2 = new MySqlDataAdapter(cmd2);
DataSet1 ds2 = new DataSet1();
adapter.Fill(ds2, "BookingDetails");
if (ds2.Tables["FoodNExtra"].Rows.Count == 0)
{
MessageBox.Show("No Data Found", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
RPTKOTQoute printKOTqoute = new RPTKOTQoute();
//RPTKitchenQoute printKOTqoute = new RPTKitchenQoute();
//RPTKOTTest printKOTqoute = new RPTKOTTest();
printKOTqoute.SetDataSource(ds);
printKOTqoute.SetDataSource(ds1);
printKOTqoute.SetDataSource(ds2);
crystalReportViewer1.ReportSource = printKOTqoute;
System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
printKOTqoute.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
printKOTqoute.PrintOptions.PrinterName = "EPSON TM-U220 Receipt";
printKOTqoute.PrintToPrinter(1, false, 0, 0);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
Я точно так же, как упоминалось here.
И когда я запускаю отчет о кристалле, нет ошибки, но данные не отображаются. Я пробовал использовать только один datatable, и он работал нормально. Также я использую MySQL как базу данных.