Skip to main content

Posts

Showing posts from May, 2014

An error occurred while updating the entries. See the inner exception for details.

If you are using EF then you may get the error. This error is not specify where the error exactly occur in your table. To specify the error use this code & use debugger to see the exact error message. try { //Your code db = new FEDALIC_AGRI_DBEntities (); model.FarmerVillage = new Guid(village); model.FarmerThana = new Guid(thana); model.FarmerDistrict = new Guid(district); var _SET_FARMER_INFO = EMFermar.SetToModelObject(model); db.SET_FARMER_INFO.Add(_SET_FARMER_INFO); db.SaveChanges(); } catch (DbUpdateException e) { var innerEx = e.InnerException; while (innerEx.InnerException != null) innerEx = innerEx.InnerException; throw new Exception(innerEx.Message); } catch (DbEntityValidationException e

Kendo UI web Grid how to set default null values to a grid when adding new row

In your Kendo UI web grid model binding just use '?' allow null in your model class property. Which property you want to use in your grid as nullable. Model : [Key] public System.Guid? CompanyId { get; set; } public System.String CompanyName { get; set; } public System.String CompanyAddress { get; set; } Kendo Grid : .Columns(columns => { columns.Bound(p => p.CompanyId).Hidden(); columns.Bound(p => p.CompanyName).Width(200); columns.Bound(p => p.CompanyAddress).Width(300); columns.Command(command => { command.Edit(); command.Destroy();}).Width(172); }) UI

how to pass the multiple values in session ASP.NET

Set Value in session // Set value in one UI in session string empIdList = GetSelectedIDofGrid(); var paramObjects = new Dictionary<string, object> { {"paramEmployeeXmlstr", empIdList}, {"paramFactoryId", ddlFactoryName.SelectedValue} }; Session["paramPayroll_RPT014_Staff"] = paramObjects; Get value from session // Get Value in another UI From session private string _paramEmployeeXmlstr = String.Empty; private string _paramFactoryId = String.Empty; var paramObjects = Session["paramPayroll_RPT014_Staff"] as Dictionary<string, object>; if (paramObjects != null) { _paramEmployeeXmlstr = (string)paramObjects["paramEmployeeXmlstr"]; _paramFactoryId = (string)paramObjects["paramFactoryId"]; }

sql row value wise count

Query: SELECT COUNT(CASE WHEN DayStatusID = 1 THEN 1 END) AS A, COUNT(CASE WHEN DayStatusID = 7 THEN 1 END) AS B, COUNT(CASE WHEN DayStatusID = 3 THEN 1 END) AS C from Payroll_tblYearMonthDayEntry Result: