// Getting data from this Admin class:
public static IQueryable<Student> GetStudents()
{
DojoDBDataContext conn = new DojoDBDataContext();
var query =
from s in conn.Students
join b in conn.Belts on s.BeltID equals b.ID
orderby s.LastName ascending
select s;
return query;
}
// And on my fo...
Hi all,
I am calling my database which contains a datetime datatype. The date looks like this:
2005-05-23 16:06:00.000
I would like to display this in a table when a user selects a certain item from a list. I call my controller action and return Json of all the times and put them in a table. The problem is the date is completely wrong...
I want to do a search for Music instruments which has its informations Name, Category and Origin as I asked in my post.
But now I want to sort/group the result by similarity/equality to the keyword such as.
If I have the list
{ Drum, Grand Piano, Guitar, Guitarrón, Harp, Piano} << sorted by name
and if I queried "p" the result should ...
I have a linq to objects query in a recursive loop and afraid when the objects approach more then 1000 and a have more then 100 users on the site -- my website will break. so is it possible to compile a linq to objects query.
The linq query does nothing more then find the direct children of a node.
...
I'm creating my generic DataContext using only the connectionString in the ctor. I have no issues in retrieving the table using DataContext.GetTable().
However, I need to also be able to retrieve entities of inline table functions. The dbml designer generates
public IQueryable<testFunctionResult> testFunction()
{
return thi...
I have a method AddStudent() which looks for a student with the same name and returns an existing student from the database if there is a student with the same name, otherwise it creates a new student and adds it to the database.
I'm curious why se = students.First<StudentEntity>(); succeeds when se = students.ElementAt<StudentEntity>(0...
Does Castle ActiveRecord's ActiveRecordMediator<> class support LINQ queries? I couldn't find any method that returns an IQueryable<>. My domain objects can't inherit from ActiveRecordLinqBase<> due to their design.
...
Looking to use linq throughout my next project to ease some of the hard labor. Before, I dive into the linq world I would like some advice on best prctices on using linq. I am still undecided on EF and linq to sql
...
I have an IList<MyList>. I'd like with LINQ keep the same list (same number of record) but I'd like reduce or/and rename some record. At the end I'd like to have IList<MyNewList>.
Update (Marc Gravell request)
We have tools to generate interface/object from Oracle stored procedure. My problem is, for some stored procedure, a lot of fiel...
Hello,
My question is how to sort a Linq query by a sub table:
Table Apps:
- app_id
- name
Table AppStatus:
- app_status_id
- app_id
- severity
- status_date
I would like to have a query with all the apps, sorted by the last status severity:
app_id name
1 first
2 second
3 third
app_status_id app_id severity sta...
Pardon me for being unable to phrase the title more exact.
Basically, I have three LINQ objects linked to tables. One is Product, the other is Company and the last is a mapping table Mapping to store what Company sells which products and by which ID this Company refers to this Product.
I am now retrieving a list of products as follows:...
Can anyone explain what are the LINQ, Lambda, Anonymous Methods, Delegates meant?
How these 3 are different for each other?
Was one replaceable for another?
I didn't get any concrete answer when i did Googling
...
I was told in L2S, the code for update and insert are the same,
db.InsertOnSubmit(row);
db.SubmitChanges();
and L2S will check to see if it is a insert or update and act approprately in the background.
Is that true?
How about L2E? I tested, looks like in L2E it is not like that. Maybe I did something wrong.
...
In Visual Studio 2008 C#, if I create a new class the following namespaces appear by default and I remove them manually every time. Is there a setting/folder template where I can go and remove these unwanted namespaces from appearing on each and every new class that's created on the project?
using System.Collections.Generic;
using Syste...
Hi All,
How to write linq query to access data from multiple table.How do you write Linq query for the following sql query:-
"select * from user,employee where user.Name='smith' and employee.company='xyz'"
...
Hey Guys, having an issue with Linq-to-SQL, I am basically doing the following but it is saying it is "UserProfile does not contain definition for Username" in the current context where I wrote "u.Username" but it does exist I have added UserProfile table to MyDbml.dbml and if I connect to another table it works fine.
TiamoDataContext c...
basically i'm trying to reproduce the following mssql query as LINQ
SELECT DISTINCT [TABLENAME], [COLUMNNAME] FROM [DATATABLE]
the closest i've got is
Dim query = (From row As DataRow In ds.Tables("DATATABLE").Rows _
Select row("COLUMNNAME") ,row("TABLENAME").Distinct
when i do the above i get the error
Range ...
What is the BEST way to convert this :
FirstName,LastName,Title,BirthDate,HireDate,City,Region
Nancy,Davolio,Sales Representative,1948-12-08,1992-05-01,Seattle,WA
Andrew,Fuller,Vice President Sales,1952-02-19,1992-08-14,Tacoma,WA
Janet,Leverling,Sales Representative,1963-08-30,1992-04-01,Kirkland,WA
Margaret,Peacock,Sales Representativ...
Team;
How are you doing? Im breaking my head trying to do this that seems simple but I can't figure it out... Suppose I have this XML as a string:
<calles>
<calle>
<nombre>CALLAO AV.</nombre>
<altura>1500</altura>
<longitud>-58.3918617027</longitud>
<latitud>-34.5916734896</latitud>
<barrio>Recoleta</barrio>
</calle>...
If I have a pair of dates, and I want to generate a list of all the dates between them (inclusive), I can do something like:
System.DateTime s = new System.DateTime(2010, 06, 05);
System.DateTime e = new System.DateTime(2010, 06, 09);
var list = Enumerable.Range(0, (e - s).Days)
.Select(value => s.AddDays(value));
What I'm stuck o...