如何使用访问数据库将参数传递给crystal report?

时间:2017-04-05 11:06:06

标签: c#

这是我的代码

if (result == DialogResult.Yes)
{
    int invoiceid = Convert.ToInt32(txtSellId.Text)-1;
    RPT.RPTPrintSellBill myreport = new RPT.RPTPrintSellBill();
    myreport.SetParameterValue("@SaleId", invoiceid);
    RPT.RptSellBill frm = new RPT.RptSellBill();
    frm.crystalReportViewer1.ReportSource = myreport;
    frm.ShowDialog();
}

这是我的数据库访问查询

SELECT SalePill.SaleId, Customer.customerName, SalePill.SaleTotalG, SalePill.SaleTotalS, SalePill.SaleItemCount, SalePill.SaleAdd, SalePill.SaleDiscount, SalePill.SaleFinalTotal, Operation.saleQty, Operation.sellUnitPrice, Operation.saleTotaG, Operation.saleDiscount, Operation.saleTotalB, Stock.StockName, Items.itemName, SalePill.SaleCustomer, SalePill.SaleDate, SalePill.SaleInvoiceNo, SalePill.SaleUser FROM Stock INNER JOIN ((Customer INNER JOIN (Items INNER JOIN (Operation INNER JOIN SalePill ON Operation.saleId = SalePill.SaleId) ON Items.itemId = Operation.operItem) ON Customer.customersId = SalePill.SaleCustomer) INNER JOIN StockItems ON Operation.stockId = StockItems.stockId) ON Stock.StockId = StockItems.stockId;

我需要通过传递发票ID

来显示一份发票

这是我使用我的代码时发生的事情

enter image description here

0 个答案:

没有答案