C# 使用SQL挑战快速报告空数据
我想向SP(SQL)发送空数据,但快速报告会将空数据转换为零,然后发送。是否有一些技巧可以将某些参数发送null,但Fast报告会将其转换为零,然后发送C# 使用SQL挑战快速报告空数据,c#,sql,c#-4.0,report,fastreport,C#,Sql,C# 4.0,Report,Fastreport,我想向SP(SQL)发送空数据,但快速报告会将空数据转换为零,然后发送。是否有一些技巧可以将某些参数发送null,但Fast报告会将其转换为零,然后发送 Desirable Execute exec MyStoreProcedure @MyParameter=NULL; But Fast Report Execute exec MyStoreProcedure @MyParameter=0; 更新: 我的代码如下: try {
Desirable Execute
exec MyStoreProcedure
@MyParameter=NULL;
But
Fast Report Execute
exec MyStoreProcedure
@MyParameter=0;
更新:
我的代码如下:
try
{
using (FastReport.Report report = new FastReport.Report())
{
report.Load(txtFile.Text);
report.ConvertNulls = false;
report.SetParameterValue("LimitList", 0);
report.SetParameterValue("InsuranceID", (int?)null);
report.SetParameterValue("RegisterMonthNumber", null);
report.SetParameterValue("RegisterYearNumber", null);
report.SetParameterValue("FromDate", "2011-08-23 00:00:00");
report.SetParameterValue("ToDate", "2019-10-02 00:00:00");
report.SetParameterValue("SickName", null);
report.SetParameterValue("SickNationalNo", null);
report.SetParameterValue("SearchOnIsCloseYear", 0);
report.SetParameterValue("NYear", 1398);
report.SetParameterValue("NMonth", (int?)null);
report.Show();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
也许您需要传递DBNull.Value
report.SetParameterValue("NMonth", System.DBNull.Value);
在报表引擎设置中有一个设置
转换空值
。这需要设置为false。@ChetanRanpariya在哪里可以设置此选项?请检查我共享的链接…@ChetanRanpariya我不知道你为什么不帮我?你的评论没有改变!再次@InsuranceID=0 Passed您是否尝试过-report.SetParameterValue(“InsuranceID”,System.DBNull.Value);-?report.ConvertNulls=false;report.SetParameterValue(“LimitList”,0);report.SetParameterValue(“保险ID”,System.DBNull.Value);有什么想法吗?@M K-你有没有尝试过为InsuranceID、RegisterMonthNumber等传递System.DBNull.Value而不是null?