I have a GridView with a SqlDataSource, select only.
Is it possible to loop through each record in the GridView and update it with LINQ? If so, I’m assuming some sort of foreach would be used?
I’m comfortable using LINQ, just not sure how to start this one.
...
I have a table structure, each table with a primary key field named as "ID" and foreign key names matching their parent table's primary key. Therefore, the tables below have relationships where their primary key appears in another table and the first field in any table is it's primary key:
Category
--------
CategoryID
Title
CategoryLi...
I have two tables:
- Attendees
- Events
Normally, I would create a mapping table 'EventAttendeeMap' to link these tables into a many to many relationship.
Is this the best way of doing so?
Should I store the list of AttendeeIds in an xml column instead on the Events table?
I am using .NET 3.5/4 with Linq as the DAL (although I think...
I have a generic List of Policy objects.
The list contains the following data
id policyNumber policySequence otherData
1 101 1 aaaa
2 101 2 bbbb
3 101 3 cccc
4 102 1 dddd
5 103 1 eeee
6 103 ...
listA is list of integer
dtListB is DataTable
I'm checking that if StudentId of ListA doesn't exist in dtListB, then add it to the dtListB.
Dim stidListA, stIdListB As Integer
For Each la In listA
stidListA = la.StudentId
For n = 0 To dtListB.Rows.Count - 1 Step 1
stIdListB = dtListB.Rows(n)...
I'm trying the following
string tl = " aaa, bbb, ccc, dddd eeeee";
var tags = new List<string>();
tags.AddRange(tl.Split(','));
tags.ForEach(x => x = x.Trim().TrimStart().TrimEnd());
var result = String.Join(",", tags.ToArray());
But it doesn't work, the tags always come back as " aaa", " bbb".
How can I trim all elemen...
Where can I get the current Linq provider for NHibernate? I am also using the current release of Fluent NHibernate (1.1). Will the current Linq provider (once I find it) play nicely with fluent?
...
Hi all
I know that lambda expressions within loops can cause problems if they use local variables. ( see http://www.jaylee.org/post/2008/11/18/Lambda-Expression-and-ForEach-loops.aspx )
Now I have a situation, where I am using a lambda expression within a LINQ query:
var products = from product in allProducts
select new...
I am new To F# but have few years experience in Classic VB, C# and LINQ
I like F# and Understand that it will by default provide support for multiple cores.
To use available multiple cores (4/5/6) on servers - is a quite advantage.
How does F# do this?
I also understand that LINQ provides Parallel processing - does it work same way as...
I'd like to translate the following SQL statement into a linq query:
select COUNT(*), itemid, globalid, title, preview, previewimage, previewimage_alt, link
from (
select distinct Id, itemid, globalid, title, preview, previewimage, previewimage_alt,
(select top 1 link from LikeCounter where GlobalId=x.GlobalId...
I'm using a Linq Query to populate a GridView.
Then I set it to the Datasource.
In the sorting event, I'd like to retrieve the the anonymous type that the query generates and find the members name.
Is it possible to do so ?
Here's an exemple of the query
var q = from inboundCall in dc.GetTable<InboundCall>()
join employee in dc.Get...
If I have two sequences and I want to process them both together, I can union them and away we go.
Now lets say I have a single item I want to process between the two sequencs. I can get it in by creating an array with a single item, but is there a neater way? i.e.
var top = new string[] { "Crusty bread", "Mayonnaise" };
string fillin...
I am attempting to be a good TDD citizen as I design an application. I'm using Moq, and I've run into a little repository issue.
My repository has a Find method:
public IEnumerable<T> Find(Expression<Func<T, bool>> where)
{
return _objectSet.Where(where);
}
Then I attempt to set up a mock of the repositor...
I have an matrix in this format that I am trying to validate and remove first row:
3 4
0 0 0
0 0 0
0 0 0
0 0 0
Where the first line is and the other lines are the actual data.
Width Height
What is the best way to A remove the first row, and B validate that all rows meet the Width Height Criteria specified? I could do a simple for...
I'm using a List in ASP.NET 3.5/C# to filter an existing list of dates (about 20 in total) on a specific month. So if a user selects a year of 2010 (ddlFromYear.SelectedItem.Text == 2010) then the returned list would consist of only 8 months because we only go up to August.
My question is - how do I output the DateTime as an int, or eve...
string.Format("{0}, {1}, {2}", var1, var2, var3)
I want to apply URL Encoding on each of var1, var2, and var3. It's not an array, so I can't use Linq Aggregate to do it.
Any ideas?
I would hate to have to put brackets around each of the variable.
...
I use this LINQ query in an app I am writing:
internal int GetNoteCount(DateTime startDate, DateTime endDate)
{
var a = DataStore.ObjectContext.Notes.Where(n => n.LastRevised >= startDate);
var b = a.Where(n => n.LastRevised <= endDate);
return b.Count();
}
Obviously, the query gets Notes that fall between two dates. I'd l...
Object is simple, it's a rate of pay:
public class RateOfPay
{
public decimal Rate { get; set; }
public DateTime Start { get; set; }
public DateTime? End { get; set; }
}
and I'm trying to get it like this:
IEnumerable<T> rates = GetRates();
/*
actual collection is DevExpress XPCollection<RateOfPay>
which imple...
I'm trying out the Razor ViewEngine from ASP.NET MVC 3 Preview 1 and I'm running into an issue trying to using the Any() extension method.
Here's the code I use to set the property in the controller:
ViewModel.Comparisons = DB.Comparisons.Where(c => c.UserID == this.UserID).ToArray();
Here's the code in the View where I try to use An...
Hi,
I have a single columned datatable inside a single tabled dataset.
I just want to convert this dataset to distinct rows. Here is my code, it gives compile error '.' expected. What am I doing wrong? (I tried adding the ., still same error). I know this is something stupidly obvious. PLZ Save me! ;)
Thanks much in advance!
Dim quer...