Posts

Showing posts with the label Crystal Report

Could not load file or assembly 'log4net, Version=1.2.10.0 Crystal report Error

 If you install 32 bit crystal report runtime software in your machine  then try this Open IIS Go to current server – > Application Pools Select the application pool your 32-bit application will run under Click Advanced setting or Application Pool Default Set Enable 32-bit Applications to True If you install 64 bit crystal report runtime software in your machine  Conversely, if you've got the 64bit version installed, ensure  Enable 32-bit Applications  is set to  False See this link from stackoverflow https://stackoverflow.com/questions/17291736/could-not-load-file-or-assembly-log4net-version-1-2-10-0-culture-neutral-pub

Load Crystal Report from Physical Path c#

using(CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new ReportDocument()) { var path = HttpContext.Current.Server.MapPath((@ "~/Reports/rptDatewiseSaleSummaryReport.rpt")); rd.Load(path); rd.SetDataSource(items); string fname = System.Web.HttpContext.Current.Server.MapPath("~/CReports") + "/" + guid.ToString() + "." + type; CrystalDecisions.Shared.DiskFileDestinationOptions dfo = new CrystalDecisions.Shared.DiskFileDestinationOptions(); dfo.DiskFileName = fname; switch (type) { case "pdf": rd.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat; break; case "xls": rd.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel; break; } rd.ExportOptions.DestinationOptions = dfo; rd.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; rd.Export(); rd.Close(); }

image not showing in crystal report viewer in asp.net

Scenario 1=> check if your web.config has the fallowing crystal image handlers... if not add it and check.!! under http handlers : < add verb= "GET" path= "CrystalImageHandler.aspx" type= "CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" /> under handlers: < add name= "CrystalImageHandler.aspx_GET" verb= "GET" path= "CrystalImageHandler.aspx" type= "CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition= "integratedMode" /> Scenario 2=> I found the solution from SAP forum. Just change settings.AutoRedirectMode = RedirectMode.Permanent to settings.AutoRedirectMode = RedirectMode.Off in RouteConfig.cs Scenario 3=> Please also try to change .Net Framework mode from Integrated to Classi...

Generate class from database table

Set @TableName to the name of your table. declare @TableName sysname = 'TableName' declare @Result varchar ( max ) = 'public class ' + @TableName + ' {' select @Result = @Result + ' public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; } ' from ( select replace ( col . name , ' ' , '_' ) ColumnName , column_id ColumnId , case typ . name when 'bigint' then 'long' when 'binary' then 'byte[]' when 'bit' then 'bool' when 'char' then 'string' when 'date' then 'DateTime' when 'datetime' then 'DateTime' when 'datetime2' then 'DateTime' when 'datetimeoffset' then 'DateTimeOffset' ...