缺少参数值 [英] Missing parameter values

查看:493
本文介绍了缺少参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想直接打印报告打印机而不显示水晶报告预览

所以我用的是代码,但我收到消息告诉我缺少参数值

此代码:



我的尝试:



I want print report directly to printer without show preview of crystal report
so i was used thid code but i got message tell me that missing parameter values
this code:

What I have tried:

引用:



public void PrintReport()

{

ReportDocument cryRpt = new ReportDocument();

cryRpt.Load(@C:\ Users \USER \Desktop \ my Activies \OldMurbad \ Murbad \ Murbad \ RPT \PrintInvoice。 rpt);

cryRpt.SetParameterValue(@ IDorder,txtInvoiceNo.Text);











TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();

TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();

ConnectionInfo crConnectionInfo = new ConnectionInfo();

表格CrTables;



crConnectionInfo.ServerName = @DELL\SQLEXPRESS;

crConnectionInfo.DatabaseName = @Murbad1;

crConnectionInfo.UserID = @IBRA;

crConnectionInfo.Password = @IBRA;



CrTables = cryRpt.Database.Tables;

foreach(CrTables中的CrystalDecisions.CrystalReports.Engine.Table CrTable)

{

crtableLogoninfo = CrTable.LogOnInfo;

crtableLogoninfo.ConnectionInfo = crConnectionInfo;

CrTable.ApplyLogOnInfo(crtableLogoninfo);

}



cryRpt.Refresh();

cryRpt.PrintToPrinter(1,true,0,0);

}


public void PrintReport()
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(@"C:\Users\USER\Desktop\my Activies\OldMurbad\Murbad\Murbad\RPT\PrintInvoice.rpt");
cryRpt.SetParameterValue("@IDorder", txtInvoiceNo.Text);





TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;

crConnectionInfo.ServerName = @"DELL\SQLEXPRESS";
crConnectionInfo.DatabaseName = @"Murbad1";
crConnectionInfo.UserID = @"IBRA";
crConnectionInfo.Password = @"IBRA";

CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}

cryRpt.Refresh();
cryRpt.PrintToPrinter(1, true, 0, 0);
}

推荐答案

您的报告似乎期望参数字段的值在报告中定义。



最简单的方法是打开报告并查看定义。请参阅 Crystal Reports参数 [ ^ ]
It seems that your report is expecting values for parameter fields that are defined in the report.

The easiest way is to open the report and have a look at the definitions. Refer to Crystal Reports Parameters[^]


这篇关于缺少参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆