var dept_list = (from map in DtMapGuestDepartment.AsEnumerable()
where map.Field<Nullable<long>>("GUEST_ID") == DRowGuestPI.Field<Nullable<long>>("PK_GUEST_ID")
join
dept in DtDepartment.AsEnumerable()
on map.Field<...
Lets say i have a Person table, a Role table with a trel table PersonRoles linking them as many to many.
I create a new person and assign them to 2 roles (role 1, role 3).
I then want to edit this person; so i retrieve their data and bind their roles to a checkboxes. I change the values (Deselect role 1 and select role 2 instead) I the...
hi,
i've two arrays like
string[] a = { "a", "b", "c" };
string[] b = { "a", "b", "c" };
i need to compare the two arrays using linq.
the comparision should take place only if both arrays have same size
...
When trying to compile the following code in LINQPad :
void Main()
{
DriveInfo.GetDrives().Select(GetProviderName).Dump();
}
static string GetProviderName(DriveInfo drive)
{
// some irrelevant WMI code...
}
I get the following error :
The type arguments for method 'System.Linq.Enumerable.Select(System.Collections.Generic....
I am trying to pull address records out of a database and group them together by address.
Simple enough right?
The problem I has is the LOCATION field is formatted as such
BUILDING: some building description
ADDRESS: 555 1st Street
or
BUILDING: some building description ADDRESS: 555 1st STREET
There are multiple instances wher...
is there a good way to do a Linq GroupBy where the grouping key is determined at runtime? e.g. I want the grouping key to be built from a user-selected list of fields - can you do this? I know I can do it easily if I convert everything to a table of strings, but I was wondering if there was an elegant or clever way to accomplish this oth...
Hi
I have the version 3.0.0.1001 nhibernate.
My objects are basically modeiling a lineup at an event. So I have a StageSet object which represents one slot in the schedule for a stage.
Each StageSet object has a Stage and an Act property.
It also has many Users - people who have favorited the set.
I'm trying to ascertain the most po...
I have seen plenty of examples on how to query the database but nothing on how to update records. Below is the simple code that I wrote to retrieve a table, but can someone explain me how can I modify a field, say lastActiveDate, and update the table on the database
Thank you,
suday
open System
open Microsoft.FSharp.Linq
let connStrin...
Lets say I have a table with RowId, and Value:
1 valueA
2 valueB
3 valueC
4 valueD
Then let's say I delete the 4th row:
1 valueA
2 valueB
3 valueC
So the next row ID will be 5. Because the 4th row was deleted, I can't simply find the last row in the table and add 1 to get the next row ID. How can I obtain the next row ID?
Thanks...
So here's my XML file:
<book>
<title>Book Title</title>
<author>Book Author</author>
<pubDates>
<date format="standard">1991-01-15</date>
<date format="friendly">January 1991</date>
</pubDates>
</book>
I'm loading the data into an XDocument, then retrieving it from the XDocument and adding it into a B...
I am new to LINQ and am trying to convert a SQL query to LINQ:
SQL:
left outer join PRODUCT_BEST_USE pbu on pbu.PRODUCT_GUID = @uProductId and pbu.BEST_USE_GUID = bu.BEST_USE_GUID
LINQ:
from PBU in PRODUCT_BEST_USE.Where(PBU=>PBU.PRODUCT_GUID == p.PRODUCT_GUID).DefaultIfEmpty()
When I add and PBU.BEST_USE_GUID equals BU.BEST_U...
I have a DataSet and I want to convert the DataSet into List<T>
T - type object
How convert my DataSet? It has 10 columns, with all 10 properties my object has and it's returning over 15000 rows. I want to return that dataset into List<obj> and loop it how do I do that?
...
I ran across an interesting Linq to SQL, uh, feature, the other day. Perhaps someone can give me a logical explanation for the reasoning behind the results. Take the code below as my example which utilizes the AdventureWorks database setup in a Linq to SQL DataContext. This is a clip from my unit test. The resulting customer returned fro...
Hello All,
I have an IEnumerable<someClass>. I need to transform it into XML. There is a property called 'ZoneId'. I need to write some XML based on this property, then I need some decendent elements that provide data relevant to the ZoneId. I know I need some type of grouping. Here's what I have attempted thus far without much success. ...
I'm looking to get query results back from Linq in the order that I pass IDs to the query. So it would look something like this:
var IDs = new int [] { 5, 20, 10 }
var items = from mytable in db.MyTable
where IDs.Contains(mytable.mytableID)
orderby // not sure what to do here
select mytable;
I'm ho...
Most of the examples I've found deal with Linq to entities, which is not what I need. I have a standard DataTable which I need to modify before returning to the caller. I can iterate over the normal Table.Rows collection or do something like this with the new extension methods:
foreach (var x in table.AsEnumerable()) {
if (x.Field<i...
I found an example online that explains how to perform databinding to a ListBox control using LINQ in WPF. The example works fine but when I replicate the same code in Silverlight it doesn't work. Is there a fundamental difference between Silverlight and WPF that I'm not aware of?
Here is an Example of the XAML:
<ListBox x:Name="list...
There are three possibilities, but I can't find examples:
System.Linq.Expressions.MemberAssignment
System.Linq.Expressions.MemberListBinding
System.Linq.Expressions.MemberMemberBinding
I want to write some unit tests to see if I can handle them, but I don't know how to write them except for the first one, which seems to be new Foo { ...
It's probably something silly I missed, but I try to concatenate a list of integers instead of summing them with:
integerArray.Aggregate((accumulator, piece) => accumulator+"," + piece)
The compiler complained about argument error. Is there a slick way to do this without having to go through a loop?
...
I was making an edit to a long existing project. Specifically I added some fields to a table and had to delete the table from the LINQTOSQL designer and re-add it. doesn't Also had to do the same for a view. Mode some other code changes and went to build . Now my project won't build because it can't resolve any of the data context object...