Input string was not in a correct format.Couldn't store

Dear Sir,

i am using fastroprt.core.2019.2.5 and FastReport.Data.SQLite.2019.2.0 , c# visual studio 2019

i am try to export report to html as follows:


MemoryStream stream = new MemoryStream();
try
{
Config.WebMode = true;
using (report)
{
report.ConvertNulls = true;
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);
}
// Handle Exceptions
catch (Exception ex)
{
// error : Input string was not in a correct format.Couldn't store <\r\n\r\n> in custaddress Column. Expected type is Int32."
return File(stream.ToArray(), mime);

}

i got the following error :
Input string was not in a correct format.Couldn't store <\r\n\r\n> in custaddress Column. Expected type is Int32.

actually custaddress is string column and may it has some records store null value others store text value


how can i solve this error

thanks

Comments

  • Hello!

    Open the .frx file in the designer (Data -> Dictionary) -> select the table and the custaddress column -> explicitly set DataType = System.String.

    Check the SQL query (if necessary, use CAST(custaddress AS TEXT) in SQLite), and when loading data manually via a DataTable, pass a pre-typed DataTable using Columns.Add(“custaddress”, typeof(string)) to report.RegisterData(...)

This discussion has been closed.