I'm having a problem and I've got the feeling it is something simple that I'm not doing right.
I've got a simple ASP.NET project going. I've got a DataSet that I populate from an Oracle database. The table in the DataSet has two columns: "account_code" and "account_descr".
The user enters in a search term into a textbox. I use LINQ to ...
I have a Person class, with Name and AreaID properties.
public class Person
{
public string Name;
public int AreaID;
// snip
}
I have a List<Person> with the potential for hundreds of Person objects in the list.
e.g., 100 Persons with AreaID = 1 and 100 Persons with AreaID = 2
I want to return distinct list of AreaID's and ...
I have the following XML and I have been trying Descendents().Descendents().Descendents to retrieve an element value but I can't get it to work.
I want to return the first value found in the first element of PersonID.
It is a string so I am doing this:
XDocument XDoc = XDocument.Parse(XmlString);
<Root>
<Code>200001</Code>
<MsgTy...
I recently faced an interview question related to LINQ.
What is the use of empty sequence?.He asked "if i suppose to ask you to use the one,where do you fit it?"
public static IEnumerable<TResult> Empty<TResult>()
{
yield break;
}
I did not answer it.Help is appreciated.
...
I have the below code in my current solution, which returns an error of 'The value '' is invalid'. The below snippet has been shortened to just show the problem area as opposed to the entire ActionResult.
Dim tComment As New hdComment
tComment.Comment = collection("wmd-input")
tComment.MadeOn = DateTime...
I am building an ASP web site that contains a large section that represents a database front end. I need to build forms to manipulate the database and obviously there would be much repitition i.t.o the type of input field and rules pertaining to the field. For example there are many tables where I have take on varchar(n) fields that coul...
I am considering the use of an EAV table in SQL Server to store some hierarchical/structured data, all the while knowing the capabilities of XML in SQL Server. I am aware of some of the performance draw backs of EAV due to excessive joins, however, does client side LINQ to object solve any of these problems?
I am looking for some advic...
I'm not entirely sure the title is properly worded, but here's the situation... I noticed today while trying to create a generic save function for Linq to Sql that when I use lambda against a data context select. It breaks within a generic function with a type constraint of another generic interface. However, it works fine with LINQ syn...
I am new to using the Html.DropDownList in the MVC framework and am having a hard time understading how to select the data out my database to bind to the DropDownList. Is there an easy way to return a bindable list (such as a SelectList) from a standard LINQ query?
...
When I'm developing ASP.NET applications I often create forms that allow users to create, retrieve, or update records in a database. Many times there's a need to be able to add child records to an item I am creating, such as adding a category to a product or some sort of order / order detail relationship. Normally I use some sort of Dr...
HI.
This is what I want to do:
str2 = "91";
str1 = "19";
var testQuery = from c1 in str1
from c2 in str2
select new {c1, c2};
foreach (var enumerable in testQuery)
{
Console.WriteLine(enumerable.c1 + " | " + enumerable.c2);
}
What I want:
9 | 1
1 | 9
What I re...
How can i apply switch..case like selection in LINQ ?
choice between this and this select this end
choice between this and this select this end
...
...
choice between this and this select this end
choice between this and this select this end
...
I've got a csv with 35K rows with, among other, the following collumns: articleID, description, class1, class2, class 3.
the class collumns represent the categories to which the products belong. class1 is the main category, class2 is a subcategory of class1 and class3 is a subcategory of class2.
Now i want to extract the categories in a ...
I'm trying to create a Linq statement that queries both columns that exist on my entity as properties and those that don't but exist as columns in the database for the entity.
For example, I have a collection of Book entities. Each Book has an ID and Title property and a matching column in the database. But, lets say the table for Book ...
Is it possible in C# 3.net to create a System.Collections.Generic.Dictionary<TKey, TValue> where TKey is unconditioned class and TValue - an anonymous class with a number of properties, for example - database column name and it's localized name.
Something like this:
new { ID = 1, Name = new { Column = "Dollar", Localized = "Доллар" } }...
I have a LINQ query to a DataTable:
var list = from row in table.AsEnumerable()
group row by row.Field<byte>("ID") into g
select new
{
ID = g.Key,
Name = (from c in g
select c.Field<string>("name")).First(),
Localized = (from c in g
select myDic[c.Field<string>("name"))].First();
};
where ID is a primary column, N...
I will be using Linq to Entities. The question that I have is, I will be calling Linq to Entities multiple times. Will Linq to Entities queries be cached will it is called several times? If not is there a way to cache the query so it is not compiled or generated every time it is called.
...
Hello everyone,
I'm really a LINQ newbie. I got an unknown problem:
public static int save(TEntity obj)
{
var table = dbo.GetTable<TEntity>();
var mapping = dbo.Mapping.GetTable(typeof(TEntity));
var pkfield = mapping.RowType.DataMembers.Where(d => d.IsPrimaryKey).Take(1).SingleOrDefault();
if (Conve...
Hi there,
i am looking for some input for how to use linq with javascript, there are number of implementations for javascript around.
anybody use any and which is the most compatible?
I was looking to be able to use linq against JSON and the DOM
Thanks in advance
...
Why doesn't link simply use the == operator in joins if t can use it in a 'where' clause?
...