私のクエリー(SQLサーバー上)がクリスタルレポート上に複製されているのはなぜですか?私の作品のスクリーンショットを提供する!これは私のコードです。私のSQLクエリーがクリスタルレポートに重複しています
myCommand = new SqlCommand("SELECT Issuance.i_ID, ProductSold.ps_pID, ProductSold.ps_Name, ProductSold.ps_Qty,Issuance.i_Issued,Issuance.i_Received,Issuance.i_Received,Issuance.i_Approved,Issuance.i_Purposed,ProductSold.ps_Amount,ProductSold.ps_Serial,Issuance.i_EntryDate FROM Issuance LEFT JOIN ProductSold ON Issuance.i_ID = ProductSold.ps_IssID WHERE Issuance.i_ID='" + txtIssuanceID.Text + "'", myConnection);
myCommand.Connection.Open();
myConnection.Close();
SqlDataAdapter sda = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
sda.Fill(ds, "Issuance");
sda.Fill(ds, "ProductSold");
rptMCT report = new rptMCT();
report.SetDataSource(ds);
report.VerifyDatabase();
crystalReportViewer1.ReportSource = report;
crystalReportViewer1.RefreshReport();
img-output in crystal reports、ありがとう!
答えはありませんが、ちょっとしたことですが、準備済みのステートメントの使用を検討する必要があります。 –
LEFT JOINは、左のテーブルと一致するすべての行を返すため、重複した結果を返します(https://stackoverflow.com/questions/916414/how-can-a-left-outer-join-return-more-records-左テーブルよりも存在する)。クエリを試して、わずか2レコードの結果を制限してみてください。 –
私は何を考えているのですか? –