Ich muss einen Crystal Report erstellen, dessen Daten aus Dataset aufgefüllt werden. Datensatz hat drei Datentypen. Nämlich:Mehrere Datentypen im Dataset verwenden
CustDetais
Buchungsdetails
FoodNExtra
Wenn ich Setup-Crystal-Bericht über Crystal Report Wizard, ich neuen Bildschirm bekam die Nicht sicher sagt, was hier zu tun, so dass ich nur als nächstes geklickt. Und heres Crystal Report Viewer meinen Code für:
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);
}
}
habe ich genauso wie here erwähnt.
Und wenn ich Kristallbericht laufen lasse, gibt es keinen Fehler aber keine Daten werden angezeigt. Ich habe versucht, nur eine Datentabelle zu verwenden, und es hat gut funktioniert. Auch ich benutze MySQL als Datenbank.