[Solved] Unable to insert mutiple values to database [closed]

You can’t do 2 sets of values like your trying to do with an INSERT statement. Your effectively doing: INSERT INTO Controller_Forecast(C1,C2…) VALUES(…loads of values…) VALUES(…Loads of more values…) This isn’t valid. To insert 2 sets of data, which is what it looks like you’re trying to do you can do 2 INSERT INTO statements … Read more

[Solved] Linq query to group payment receipts for a person over a period

Based on the view you want to display, your models are incorrect and they need to be public class MemberPaymentVM { public string MemberName{ get; set; } public string TransactId { get; set; } [DisplayFormat(DataFormatString = “{0:d}”)] public DateTime PayDate { get; set; } public IEnumerable<CategoryAmountsVM> Payments { get; set; } [DisplayFormat(DataFormatString = “{0:C}”)] public … Read more

[Solved] How to use the Except in C# [closed]

You could use Enumerable.Except on these fields: var sendIdentityFields = from s in sendTable.AsEnumerable() select new { BUS = s.Field<int>(“BUS”), IDENT = s.Field<int>(“IDENT”), STATION = s.Field<int>(“STATION”), REF1 = s.Field<string>(“REF1”), REF2 = s.Field<string>(“REF2”), REF3 = s.Field<string>(“REF3”), REF4 = s.Field<string>(“REF4”), REF5 = s.Field<string>(“REF5”), REF6 = s.Field<string>(“REF6”), REF7 = s.Field<string>(“REF7”), REF8 = s.Field<string>(“REF8”) }; var receivedIdentityFields = from … Read more

[Solved] List permutation existance

A variation on Save’s solution: var fixedSet = new HashSet<int>(){A,B,C}; bool result = PossibleSolutions.Any(x => fixedSet.SetEquals( new[] { x.CapacitorALocation,x.CapacitorBLocation,x.CapacitorCLocation })); 3 solved List permutation existance

[Solved] How do I import data from a class C#

This code returns ordered names of all men in collection: public static IEnumerable<string> OrderedMales(IEnumerable<Person> persons) { return persons.Where(p => p.Sex == Gender.Male).OrderBy(p => p.Name).Select(p => p.Name); } 0 solved How do I import data from a class C#

[Solved] ASP.NET MVC – Complex Queries [closed]

Introduction ASP.NET MVC is a powerful web development framework that allows developers to create dynamic, data-driven web applications. It is a great platform for creating complex queries that can be used to retrieve data from a database. In this article, we will discuss how to create complex queries in ASP.NET MVC and how to use … Read more

[Solved] Which type should I return?

You can’t return anonymous types from a method (i.e. select new { … }). You need to create a class for that or use Market_Masters if it is of that type, e.g.: public IEnumerable<Market_Masters> GetMaster() { var x = from n in db.Masters join chil in db.ChildMasterMasters on n.MasterId equals chil.MasterId into t select new … Read more

[Solved] How to change the order properties are serialized in C#

You can order them by using Order on DataMember like this: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Serialization; namespace Mvm.SATWeb.Domain { [Serializable, DataContract] public class puntoDeAtencion { public puntoDeAtencion() { } [DataMember(Order = 0)] public string codigoPuntoAtencion { get; set; } [DataMember(Order = 1)] public decimal montoIngreso { get; set; } [DataMember(Order … Read more

[Solved] How to create string from array of strings [duplicate]

There is the String.Join-method designed for this. var mystring = String.Join(” OR “, idsArr); This will result in the following string: export_sdf_id=3746 OR export_sdf_id=3806 OR export_sdf_id=23 OR export_sdf_id=6458 OR export_sdf_id=3740 OR export_sdf_id=3739 OR export_sdf_id=3742 Note that the brackets are omited as they are not needed for your query. 1 solved How to create string from … Read more