public List<string> _DELIVERYNO;
private void get_INVOICE_DATA_RPT()
{
_DELIVERYNO = new List<string>();
foreach (DataGridViewRow row in grdDNList.Rows)
{
DataGridViewCheckBoxCell chk = row.Cells[0] as DataGridViewCheckBoxCell;
if (Convert.ToBoolean(chk.Value) == true)
if (row.Cells.Count >= 2 && row.Cells[2].Value != null)
{
_DELIVERYNO.Add(row.Cells[2].Value.ToString());
}
}
foreach (var value in list)
{
get_INVOICE_DATA(value);
}
}
Get the Delivery No from DataGridView and store to List.
The parameters are passed from frm1 to crystal report is OK
private void frmPrinINVOICE_02_Load(object sender, EventArgs e)
{
var rpt = new ReportDocument();
rpt.Load("rptSalesInvoice_02.rpt");
rpt.SetDatabaseLogon(userName2, passWord2, @serverName2, databaseName2);
rpt.Refresh();
crystalReportViewer1.RefreshReport();
foreach (var value in frm1._DELIVERYNO)
{
rpt.SetParameterValue("@DELIVERYNO", value);
}
crystalReportViewer1.ReportSource = rpt;
}
But the report source only keep the last data from the last query return by the last DELIVERYNO Example: DELIVERY No: 6425,6758,6927 were passed from the frm1 . But the report only display last query return by DELIVERY No:6927 .
So my question how to Loop the parameter but it must keep all the data return by all passed parameters (DELIVERY No: 6425,6758,6927)
And here is the SQL store procedure:
PROCEDURE [dbo].[proc_IVHead_Get_INVOICE_DATA]
@DELIVERYNO nvarchar(50)
AS
select *
from [ENVNDIVDB].[dbo].[IVHead] a
inner join [ENVNDIVDB].[dbo].[IVRecords] b
on a.DELIVERYNO=b.DELIVERYNO
WHERE B.[DELIVERYNO] =@DELIVERYNO
ORDER BY a.DELIVERYNO
Can we store loop result into temp table then get data out from them?