A follow-up from this question, I've changed my controller and routing around so that now the sort value is assigned by ?sort= however I also want to implement the ability for users to filter the table based on a select set of values:
Technician : Tech1, Tech2, Tech3, etc.
Category : Category1, Category2, Category3, etc.
Priority : Prio...
There is a hard limit of the number of parameters any single SQL statement can have, and that is 2100 (for SQL Server 2005), or 1024 (for SQL Server 2000).
Does anyone know of a way to increase that number?
If you'd like to know "why" (as I would be dying of curiosity myself), the ansewr is in this:
MyL2SDataContext.Accounts.Where(acc...
I'm really struggling to wrap my head around some of this stuff. Let me give an example of where I'm struggling.
I'm using Linq-2-Sql as the DAL for my app and the IRepository pattern used in the MVC Storefront sample app from Rob Conery.
In my domain I have a Customer Model which has a collection of Address Models. In my UI there is a...
Can LINQ-To-SQL be used Asynchronously?
Are there any OR Mappers that allow Asynchronous operations?
CLOSED: See http://stackoverflow.com/questions/252355/how-to-write-asynchronous-linq-query
...
I'm using Linq-to-SQL with a SQL Server backend (of course) as an ORM for a project. I need to get the result set from a stored procedure that returns from a dynamically-created table. Here's what the proc looks like:
CREATE procedure [RetailAdmin].[TitleSearch] (
@isbn varchar(50), @author varchar(50),
@title varchar(50))
as
declare ...
I have a combo box in Silverlight. It has a collection of values built out of the properties of one of my LINQ-to-SQL objects (ie Name, Address, Age, etc...). I would like to filter my results based off the value selected in a combo box.
Example: Say I want everyone with a last name "Smith". I'd select 'Last Name' from the drop down ...
My appologies upfront for the lengthy question. I made quite an effort to make my question as clear as possible in one go. Please bear with me. ;o) any help will be greatly appreciated!
I have the classes Branch and Text:
class Branch
int ID
Text WebDescription
and a bunch of other properties
class Text
int ID
string UK
string N...
Hi,
I have been puzzling over a problem this morning with LinqToSQL. I'll try and summarise with the abbreviated example below to explain my point.
I have DB two tables:
table Parent
{
ParentId
}
table Child
{
ChildId
ParentId [FK]
Name
Age
}
These have LinqToSQL equivalent classes in my project, however, I have writ...
I have two tables (well, two relevant for this question) :
Bets (holds the bets; Columns : Id, , MessagesPosted, )
Bets_Messages (holds the bets' forum messages; Columns : Id, BetId, )
When I insert a new BetMessage in Bets_Messages I want to update (increment to be precise) the corresponding field in Bets.
In pure T-SQL that would be...
I have a table that contains some blob fields that I don't want to load by default.
In a dbml file it is possible to set the delay loaded property for such fields.
Is there a similar option for external mapping files?
...
I've got a guy who is a wizard at writing stored procs and he can munch 10 tables down to a single column in no time at all. I'm half tempted to invest a couple of days to work with him on returning XML instead of rowsets because I can digest those all day long without any problem. I say that because it is a challenge to get a result of ...
I have this code:
using DC = MV6DataContext;
using MV6; // Business Logic Layer
// ...
public DC.MV6DataContext dc = new DC.MV6DataContext(ConnectionString);
IP ip = new IP(Request.UserHostAddress);
dc.IPs.InsertOnSubmit(ip);
dc.SubmitChanges();
// in Business Logic layer:
public class IP : DC.IP {
public IP(string address) { ... }
...
Whichever way I do it, it seems something goes wrong when using the conditional operator on enum values in Linq to Sql. For example
var ret = from listings in db.Listings
select new Listing
{
ID = listings.ID,
//etc
OrderStatus = listings.OrderItems.Count > 0
? listings.OrderItems.First().Order.OrderStatus : OrderStatu...
I have a foreign key constraint between tables Sessions and Users. Specifically, Sessions.UID = Users.ID. Sometimes, I want Sessions.UID to be null. Can this be allowed? Any time I try to do this, I get an FK Constraint Violation.
Specifically, I'm inserting a row into Sessions via LINQ. I set the Session.User = null; and I get this err...
Hi,
I have some code like this:
Function GetTypeFromTableName(ByVal _TableName As String, ByVal _DataContext As DataContext)
Dim Mytype As Type = (From t In _DataContext.Mapping.GetTables Where t.TableName = "dbo." + _TableName Select t.RowType.Type).SingleOrDefault
Return Mytype
End Function
Dim DBA As New LINQDataContext
_...
How would the following sql statement translate to a linq query?
select ID,
Price,
dbo.fGetText(DescriptionID, defaultLanguage, currentUserLanguage)
from Products
The UDF fGetText is quite substantial and used throughout the code base, so it needs to be encapsulated (as a UDF or otherwise, perhaps a Linq Expression).
...
I have always inserted my Linq2SQL queries all over the place, in almost every class all over the place.
I woud like to know what your strategy about where to put your Linq2SQL queries?
Do you put them in separate datalayer classes or do you store them where they are used all over the place?
I think that I need to chang my strategy f...
How could I do something like this in Linq to SQL (VB.NET if possible)?
SELECT *, ISNULL(DueDate, DATEADD(year, 10, GETDATE())) AS DueDateForSorting
FROM Tasks
ORDER BY DueDateForSorting
...
I have a Task entity in my Linq to SQL dbml. It's self referencing with ID and ParentID columns. I have an Association that associates the two IDs together.
it seems like everything works fine in the intellisense. It'll let me type out Task.Parent.ID and even Task.Parent.Parent.ID, etc. However, it gives me the ol' "Object referen...
I am having trouble replicating the following sql as a LINQ statement
select TableA.* from TableA left outer join TableAinTableB on TableA.Id = TableAId where TableBId is null
The following returns no lines
from TableA in db.TableA join AinB in db.TableAinTableB on TableA.Id equals TableAId where AinB.TableBId == null select TableA
...