I have a Xamarin.Forms app which has a ListView. I would like to populate the ListView with the 5 most recent items where the date is today’s date. If there are less than 5 items, the ListView should only display a row for each item (for example, if there is only one item, the ListView should only have one row).
Tag: linq-to-sql
Group By and Count the total number of same status value
I have 2 tables, Order and Store. And here are some of the fields from the table I need. Order table OrderId StoreId SystemOrderStatus 1 1 Received 2 1 Sent …
Stored Procedure Return Type Can Not Be Detected
I am trying to drag this procedure over to the dbml in VS 2012 and I am getting the return type cannot be detected message. I have tried these: LINQ to SQL – Stored Procedure Return Type Error The …
Converting a “DBML” file to a “SQL database file”
I have the DBML file of a database and would like to generate an SQL database file from this file. Thanks
How to store a list in a column of a database table
So, per Mehrdad’s answer to a related question, I get it that a “proper” database table column doesn’t store a list. Rather, you should create another table that effectively holds the elements of said list and then link to it directly or through a junction table. However, the type of list I want to create will be composed of unique
Sql Query to Linq
How would I convert this query from SQL to Linq: Update Thanks Guys, this is the code I used. Tested and returns the same as above: Answer I don’t know if the syntax is correct (especially the last two lines) but it should be pretty close. I added the 0 between group and by based on Eamon Nerbonne’s correction in
LINQ to SQL – Left Outer Join with multiple join conditions
I have the following SQL, which I am trying to translate to LINQ: I have seen the typical implementation of the left outer join (ie. into x from y in x.DefaultIfEmpty() etc.) but am unsure how to introduce the other join condition (AND f.otherid = 17) EDIT Why is the AND f.otherid = 17 condition part of the JOIN instead
efficient way to implement paging
Should I use LINQ’s Skip() and Take() method for paging, or implement my own paging with a SQL query? Which is most efficient? Why would I choose one over the other? I’m using SQL Server 2008, ASP.NET MVC and LINQ. Answer Trying to give you a brief answer to your doubt, if you execute the skip(n).take(m) methods on linq (with
How can you handle an IN sub-query with LINQ to SQL?
I’m a bit stuck on this. Basically I want to do something like the following SQL query in LINQ to SQL: Any help would be gratefully received. Answer Have a look at this article. Basically, if you want to get the equivalent of IN, you need to construct an inner query first, and then use the Contains() method. Here’s my
What is the syntax for an inner join in LINQ to SQL?
I’m writing a LINQ to SQL statement, and I’m after the standard syntax for a normal inner join with an ON clause in C#. How do you represent the following in LINQ to SQL: select DealerContact.* from …