I have a database table with transactions. In one of the fields there is an XML message, the field type is “xml”. In this XML there is an employee filed and it is this field that I need to search. I want to retrieve all the rows that match the employee number supplied at runtime. Is it possible to do this with Linq ?
Shown here is some...
hi ,
i need to insert a record with linq
i have a namevaluecollection with the data from a form post..
so started in the name=value&name2=value2 etc.. type format
thing is i need to inset all these values into the table, but of course the table fields are typed, and i need to type up the data before inserting it
i could of course exp...
When grouping numbers ,I use
string[] numbers =
{ "123", "34555", "91882", "100", "7823", "1111", "76551" };
var query = from digits in numbers
group digits by digits.Length into ByDigit
select
new { digit = ByDigit, length = ByDigit.Key };
When i suppose to use
var query = ...
Hi, i´m trying to query a DataTable object without specifying the fields, like this :
var linqdata = from ItemA in ItemData.AsEnumerable()
select ItemA
but the returning type is
System.Data.EnumerableRowCollection<System.Data.DataRow>
and I need the following returning type
System.Data.EnumerableRowCollection<<object,object>>
(...
I am trying to sort a LINQ to SQL query based on two fields. The first field is occasionally null which automatically sorts to the top of an ascending query. Is there any way to make the null entries sort to the bottom?
Here is an example:
From x in SampleDataContext.Event _
Order By x.Date, x.Sequence_Number _
Select x.Date, x.Seq...
I have a class with fields ColDescriptionOne(string), ColDescriptionTwo(string) and ColCodelist(int). I want to get the Intersect of two lists of this class where the desc are equal but the codelist is different.
I can use the Where clause and get what I need. However I can't seem to make it work using a custom Comparer like this:
inte...
I want to display a customer's accounting history in a DataGridView and I want to have a column that displays the running total for their balance. The old way I did this was by getting the data, looping through the data, and adding rows to the DataGridView one-by-one and calculating the running total at that time. Lame. I would much r...
From the given Product List
List<Product> productList = new List<Product>();
productList.Add(new Product("P001", 34566.78M, "North"));
productList.Add(new Product("P004", 4566.78M, "East"));
productList.Add(new Product("P007", 14566.78M, "South"));
productList.Add(new Product("P010", 2456.178M, "South"));
productList.Add(new Product("...
im trying to parse an rss feed on localhost, and it brings back the right results, but when i try to do that from another (preproduction server) and live, it returns a list of comments made by users on the hydrapinion website which is completely unrelated, have i been spoofed? how can i debug this? its just an rss feed and a simple LINQ ...
I'm just getting my feet wet with .Net and Linq-to-Sql, so please bear with me. I've got three tables: User, AccountDetails and UserProfile. User is the parent to both AccountDetails and UserProfile, and the relationships are all 1 to 1. When I get a User object, I get the AccountDetail and UserProfile properties as expected. However...
I have a list of strings in list. How do I use LINQ to get the last string in the list which has the character 'P' in the second position of the string. I would like to do this in a single statement using LINQ instead of doing a search in a conventional loop.
Example. The list contains these 3 strings:
Search a fox
APPLE
Going to schoo...
I'm having a table which contains userId, regBy, regDate and so many..
I need a out of regDate, regBy and count(userId).
How can a query this using LINQ..
...
From the list
class Delivery
{
public string ProductCode
{
get;
set;
}
public DateTime? OrderedDate
{
get;
set;
}
public DateTime? DeliveryDate
{
get;
set;
}
public Delivery(string pcode, DateTime? orddate, DateTime? deldate)
{
Product...
I know about the method discussed here:
Solving common problems with Compiled Queries in Linq to Sql for high demand ASP.NET websites
... but this doesn't work for my situation as i get a :
"Setting load options is not allowed after results have been returned from a query."
I am using Codesmith PLINQO scripts to generate entities and...
Hello.
I have login and logout events and i need to calculate time between them.
I guess i could group each 2 rows (each two messages) and then do the calculation, but how would you do that?
Example XML i need to query:
<Log>
<Message>
<DateTime>2009-12-02 14:38:41</DateTime>
<Priority>Local3.Info</Priority>
<Source_Hos...
I want to rewrite certain parts of the LINQ expression just before execution. And I'm having problems injecting my rewriter in the correct place (at all actually).
Looking at the Entity Framework source (in reflector) it in the end comes down to the IQueryProvider.Execute which in EF is coupled to the expression by the ObjectContext off...
I'm wondering if there is a better way to do the following,
IList<RoleViewModel> ReturnViewModel = new List<RoleViewModel>();
IList<Role> AllRoles = PermServ.GetAllRoles();
foreach (var CurRole in AllRoles)
{
ReturnViewModel.Add(new RoleViewModel(CurRole));
}
Its pretty simple code simply taking the Data ...
I am trying to AVERAGE 6 different fields on a DataTable, but without grouping. Just the AVERAGE. I have found a couple of examples in C#, but can't find any examples for how to do this in VB. Can someone please help me convert the syntax?
Here is what I have so far:
Dim query = From dtRow In dtIn.AsEnumerable _
Where d...
hi there
i am doing a query thus:
int numberInInterval = (from dsStatistics.J2RespondentRow item in jStats.J2Respondent
where item.EndTime > dtIntervalLower && item.EndTime <= dtIntervalUpper
select item).count();
there appear to be some dbnulls in the endtime column..
any way i can avoid these?
...
I have a first query that returns a set of entities:
var resultSet = ....query....ToList();
which would return A, B, C, D, E
The entities inside this set are organized into chains because they have a reference (prevEntityId) pointing to the same type of entity, i.e.:
A -> B -> D
C -> E
I would like to write a second query so that ...