我有两种形式,Form1(DGV1 & DGV2)并且两种形式Form2(DGV3 & DGV4)都有Datagridview控件.
在Form1那里有一个Form2用户可以添加行的按钮链接Form1 datagridview(DGV1).在Form2 ? (DGV3 and DGV4),checkbox第一列中有一个,用户一次只能选择一行.
有两个按钮Form2:Done和Add Items
当用户通过一个接一个地选择行来单击"添加项目"时,必须将行添加到" datagridview打开" Form1,单击"完成"按钮时,Form1应显示添加的所有行.
我做到了这一点.
列中的DGV1和DGV2是
DGV1色谱柱
Sno Desciption SellQty ItemID
----------------------------
1 ABC 0 1
2 XYZ 0 2
Run Code Online (Sandbox Code Playgroud)
DGV2色谱柱
Sno BatchNo SellQty ItemID
----------------------------
1 123 10 1
2 528 20 2
1 568 30 1
2 …Run Code Online (Sandbox Code Playgroud) 使用VS 2008.
我有两个存储过程,一个用于获取主报表的数据,另一个用于Sub报表,并且两个SP都使用相同的参数QuoteID.
我使用ReportDocument将参数发送到主报表.但我不知道如何将参数发送到SubReport.
我使用reportdocument的setparameter方法尝试了许多diff方法,该方法也将子报告名称作为参数.但它没有.
以下是我使用过的代码
string Type = gvQuotationDetails.Rows[QuoteIndex].Cells["Type"].EditedFormattedValue.ToString();
FilePath = ConfigurationManager.AppSettings["EMP_IMG_PATH"].ToString() + "\\" + ValQuoteID.ToString() + ".pdf";
DeleteExistingFile(FilePath);
try
{
AccountsPayableMaster objAPM = new AccountsPayableMaster();
QuotationReport obj = new QuotationReport();
objReportDocument.Load(Application.StartupPath + @"\rptQuotationReport.rpt");
obj.crysQuotationReport.LogOnInfo = objAPM.ConnectionDetails("SD_SalesOrderReport;1");
obj.crysQuotationReport.LogOnInfo = objAPM.ConnectionDetails("SD_GetBatchReportDetails;1");
obj.crysQuotationReport.ReportSource = objReportDocument;
objReportDocument.SetParameterValue("@QuoteID", ValQuoteID);
objReportDocument.SetParameterValue("Type", Type);
//objReportDocument.Subreports[Application.StartupPath + @"\BatchSubReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);
//objReportDocument.Subreports["BatchReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);
string[] Print = objAPM.GetPrintDetails();
SetPrintParameters(objReportDocument, Print);
obj.Show();
objReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, FilePath);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Run Code Online (Sandbox Code Playgroud)
将参数发送到子报表
//objReportDocument.Subreports[Application.StartupPath + @"\BatchSubReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);
//objReportDocument.Subreports["BatchReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);
////objReportDocument.SetParameterValue("@QuoteID", ValQuoteID,"BatchReport.rpt);
Run Code Online (Sandbox Code Playgroud)
什么都没有用.我已经浪费了两天时间. …