Ich habe diese Schleife auf meinem Bericht über C# winform Kristall Bericht.C# Crystal Bericht Detail Schleife
Die Daten in meinem Bericht wiederholt eingegeben, aber wenn ich die Datenbank überprüft, wird nur einmal gespeichert. Berücksichtigen Sie, dass der endgültige Wert korrekt ist.
try
{
Cursor = Cursors.WaitCursor;
Reports.OfficialReceipt crt = new Reports.OfficialReceipt();
cmd = new MySqlCommand();
MySqlDataAdapter myDA = new MySqlDataAdapter();
DataSet DaTs = new DataSet();
con = new MySqlConnection(cs);
cmd.Connection = con;
cmd.CommandText = "SELECT collection_type.collection_id, collection_type.school_year, collection_type.IDno, collection_type.student_org_desc, collection_type.man_org, collection_type.grand_total, collection_type.tendered_cash, collection_type.payment_change, collection_type.collection_date, student_info.FName, student_info.LName, accounts.name, collection_list.detail, collection_list.unit, collection_list.amount FROM collection_type JOIN collection_list on (collection_type.collection_id = collection_list.collection_id) JOIN accounts on (accounts.id = collection_type.account_id) JOIN student_info on (student_info.IDno = collection_type.IDno) WHERE collection_type.IDno='" + txtIDNo_Collection.Text + "'";
cmd.CommandType = CommandType.Text;
myDA.SelectCommand = cmd;
myDA.Fill(DaTs, "collection_type");
myDA.Fill(DaTs, "student_info");
myDA.Fill(DaTs, "accounts");
myDA.Fill(DaTs, "collection_list");
crt.SetDataSource(DaTs);
Reports.frmSampleForm frm = new Reports.frmSampleForm();
frm.crystalReportViewer1.ReportSource = crt;
frm.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Haben Sie verknüpfte Tabellen? Das kann mehrere Duplikate verursachen – KuKeC
meinst du Verbindungen von ** ID **? .., sollte ich dann meine Tabellen verknüpfen? oder entfernen Sie sie? –
Sie sollten Links aus der Tabelle entfernen und dann die Ausgabe sehen. Ich hatte mehrere ähnliche Probleme, als ich mich falsch an zwei Tischen anschließen musste. – KuKeC