Questions tagged as 'linq'

2
answers

how to obtain data in a single query based on a list? LINQ

I get a list that contains the level of access to a request and I want to get a list of requests that have this level. when returning "return vrequest.AsEnumerable (). ToList ();" I get this error You can not create a constant value of type 'S...
asked by 14.02.2018 / 15:37
1
answer

LINQ returns repeated records

I have a table with the same ID in two records and it returns a single one repeated. I tried two ways and the same thing happens. var x = db.SFI_Mix.Where(c => c.ID_Mix == id).Distinct().ToList(); and with string sql = "SELECT * FROM S...
asked by 19.07.2017 / 19:35
2
answers

How can I filter the records of one table that are not in another with linq C #?

For example I have a table "table1" with the fields id and name. I have another table "table2" with the fields id, idtabla1 and description. What I'm looking for is to make a query with linq that returns the records in table1 that do not appear...
asked by 17.04.2017 / 22:13
1
answer

Finder 3 different fields from 3 different tables

I have 3 tables, Comics (id, Name, number ...), Authors (id, name ...) and Illustrators (id, name ...), what I want to do is a query (for a search engine ) that if I tell him to look for the word "Batman" show me if there are coincidences in the...
asked by 21.11.2016 / 16:40
2
answers

How to use OfType

In a single Oftype you can do several searches like TextBox, ComboBox, etc. foreach (Control c in frm.Controls.OfType<TextBox>()) I want to achieve something like this foreach (Control c in frm.Controls.OfType<TextBox || TextBox...
asked by 16.10.2016 / 04:39
2
answers

Search for items in a list

Hello, I need to search for items from a list, I have a Client class public class Cliente { public int ClienteId { get; set; } public string RazonSocial { get; set; } public EnumDocumentoEdentidad DocumentoIdentidad { get; set; }...
asked by 16.10.2016 / 00:35
2
answers

List Dropdownlist dependent or Married - Visual.Net -MVC

I would like to know how to use dependent Dropdownlist, for example that the CITY depends on the REGION, and that of the COUNTRY. I am currently using this way of working when listing a dropdownlist: In the controller;      Function Update...
asked by 12.07.2016 / 03:14
1
answer

Unable to convert type 'System.Int32' to type 'System.Object'

I am working with Entity Framework with mvc and on the client side I have implemented a Select2 for this I have created the following model: public class Select2 { public int id { get; set; } public string text { get; set; } public...
asked by 26.12.2018 / 17:15
1
answer

Get the value of a field with Linq

I want to get the value of the field extension and be able to use it in a variable but it marks me error. This is the code I'm using var ext = (from ex in ctx.usuarios_bastion where ex.id == idus select ex).ToList().ToString();...
asked by 22.11.2018 / 22:15
1
answer

query in LINQ, select with different tables

see this method, I repeat the (from Proyectos in db.Proyectos select Proyectos.idProyecto).Max(); I do not like it, I want in var db , get the name of the table, this table previously had already made an insert and in this method...
asked by 29.11.2018 / 18:31