set report sql select command
i am using fastreport : (FastReport.OpenSource.Data.SQLite)
when i am try to change select command through :
TableDataSource table = report.GetDataSource("Table") as TableDataSource;
table.SelectCommand = "Select * from Customers"; // CustCode,CustName,CustAddress,CTel,Job,Remarks,....
MemoryStream stream = new MemoryStream();
try
{
Config.WebMode = true;
using (report)
{
report.ConvertNulls = true;
report.Prepare();
HTMLExport export = new HTMLExport();
export.Layers = true;
export.EmbedPictures = true;
export.Export(report, stream);
stream.Flush();
}
mime = "text/html";// + query.Format; // Override mime for html
return File(stream.ToArray(), mime, MvarReportFileName);
}
catch (Exception ex)
{
//{System.Exception: Text30: Error in expression: Table.CustAddress at FastReport.TextObjectBase.CalcAndFormatExpression(String expression, Int32 expressionIndex) at FastReport.TextObject.GetData() ...
return File(stream.ToArray(), mime);
}
i got the following error When Field CustAddress is null :
System.Exception: Text30: Error in expression: Table.CustAddress at FastReport.TextObjectBase.CalcAndFormatExpression(String expression, Int32 expressionIndex) at FastReport.TextObject.GetData() ...
if i change the select statement to "select CustCode,CustName,ifnull(CustAddress,'') as CustAddress erorr disappeared
the error comes when certain field has null value , even if i set report.ConvertNulls=true
do you have easy solution other than ifnull function to set the null database field to space ???
when i am try to change select command through :
TableDataSource table = report.GetDataSource("Table") as TableDataSource;
table.SelectCommand = "Select * from Customers"; // CustCode,CustName,CustAddress,CTel,Job,Remarks,....
MemoryStream stream = new MemoryStream();
try
{
Config.WebMode = true;
using (report)
{
report.ConvertNulls = true;
report.Prepare();
HTMLExport export = new HTMLExport();
export.Layers = true;
export.EmbedPictures = true;
export.Export(report, stream);
stream.Flush();
}
mime = "text/html";// + query.Format; // Override mime for html
return File(stream.ToArray(), mime, MvarReportFileName);
}
catch (Exception ex)
{
//{System.Exception: Text30: Error in expression: Table.CustAddress at FastReport.TextObjectBase.CalcAndFormatExpression(String expression, Int32 expressionIndex) at FastReport.TextObject.GetData() ...
return File(stream.ToArray(), mime);
}
i got the following error When Field CustAddress is null :
System.Exception: Text30: Error in expression: Table.CustAddress at FastReport.TextObjectBase.CalcAndFormatExpression(String expression, Int32 expressionIndex) at FastReport.TextObject.GetData() ...
if i change the select statement to "select CustCode,CustName,ifnull(CustAddress,'') as CustAddress erorr disappeared
the error comes when certain field has null value , even if i set report.ConvertNulls=true
do you have easy solution other than ifnull function to set the null database field to space ???