0
我有一個表tbl_invoice。我想在此表中顯示數據的水晶報告。對於每張發票,我都有invoiceid(主鍵)和帳單號。每個發票的主鍵都會更改,但billno保持不變。我得到了最大invoiceid的billno並將它傳遞給水晶報告。但它只顯示了水晶報告中的最後一條記錄。如何顯示與帳單相符的所有記錄? 我寫了這個代碼水晶報告:如何獲取多個參數傳遞給水晶報告
private void button1_Click(object sender, EventArgs e)
{
SalesInvoice_Caret crt = new SalesInvoice_Caret();
crt.SetParameterValue("BillNo", txtBillNo.Text);
crystalReportViewer1.ReportSource = crt;
crystalReportViewer1.Refresh();
}
private void crt_sales_invoice_viewer_Load(object sender, EventArgs e)
{
string getBill = "Select top 1 BillNo from tbl_sales_invoice order by SalesInvoiceId desc";
SqlCommand cmd = new SqlCommand(getBill, con);
con.Open();
object obj = cmd.ExecuteScalar();
con.Close();
MessageBox.Show(obj.ToString());
txtBillNo.Text = obj.ToString();
}