I'm not entirely sure if I'm trying to do something a little too complex for this but what I essentially want to do is turn this:
declare @callid int
set @callid = 57
declare @update nvarchar(max)
declare update_cursor cursor for
select UpdateIdentity from [Helpdesk_HR].[dbo].[hdEvents]
where CallID = @callid group by UpdateIdentity or...
I have a question closely related to the scenario described here: http://stackoverflow.com/questions/293216/linq-to-sql-bug-or-very-strange-feature-when-using-iqueryable-foreach-and-mul
I have a similar problem but in my case the correspondance to the filter list is a List of IQueryables of int's and I get the same type of problem. In m...
Hi there I basically need a function with the following signature
Expression<Func<T, object>> GetPropertyLambda(string propertyName)
I have made a few attempts but the problem arise when the property is nullable
it goes something like this
ParameterExpression param = Expression.Parameter(typeof(T), "arg");
Expression member = Expre...
Using LINQ, how can I get the column names of a table? C# 3.0, 3.5 framework
...
Given the following structure...
class Foo {
public string Category { get; set; }
public string Code { get; set; }
public int Quantity { get; set; }
}
I am trying to use Linq to summarise a list of these objects by Category and Code, so that if I provide the following source...
List<Foo> foos = new List<Foo>() {
new Foo {Ca...
I have a 2-dimensional array of objects (predominantly, but not exclusively strings) that I want to filter by a string (sSearch) using LINQ. The following query works, but isn't as fast as I would like.
I have changed Count to Any, which led to a significant increase in speed and replaced Contains by a regular expression that ignores ca...
I'm using the latest subsonic dll and the latest linq templates from github. The db i'm inserting into is MySQL. Id column on table is primary key auto increment.
Versions:
Subsonic.Core.dll - 3.0.0.3 - (November 18, 2009 Merged pulls from Github).
LinqTemplates - July 29, 2009.
MySQL.Data.CF.dll - 6.1.2.0.
The row is inserted but th...
where can i find the latest Repository.tt template?
Is the latest one here: http://blog.wekeroad.com/blog/subsonic-3-0-repository-template-update/ - November 2008?
I can't seem to find the repository.tt file on github. I'm using the latest linq templates. I've read that the repository class is generated from the default templates. I ca...
Is there a way to determine if an XElement contains one of any specified elements? For example, I have XElements that I'll want to check:
Dim xe1 = <color><blue/></color>
Dim xe2 = <color><red/></color>
Dim xe3 = <color><powderBlue/></color>
Dim xe4 = <color><aqua/></color>
Dim xe5 = <color><green/></color>
I'd like to be able to quer...
I use Castle ActiveRecord as my persistance layer.
I got this functions that must return the first 20 users from the database.
IList<User> users = new List<User>();
var userQuery = from u in User.FindAll()
orderby u.CreationDate
select u;
return userQuery.Take(20).ToList();
In my database, I currentl...
In Sql, let's say I have the following procedure
GetCars
(
@Ids nvarchar(MAX) = NULL // represent a list of Id (with comma)
@TypeIds nvarchar(MAX) = NULL // represent a list of TypeId (with comma)
)
// After transforming my Ids and TypeIds into CSVTABLE (comma seperated values table)
SELECT * FROM CARS
WHERE ((@Id IS ...
Hi folks,
is it possible to add an extension method to IQueryable<T> and then, for my Linq2Sql or EF or NHibernate or LinqToObjects, define it's functionality / how each repository will impliment this method / translate this method to some sql?
For example, imagine I want the following :-
var result = (from q in db.Categories()
...
Hi guys,
how I can get a random row from a selection in my linq query?
I tried:
Bot bot = (from a in dc.Bot
select a).OrderBy(x => Guid.NewGuid()).First();
But doesn't work, I ever get the same.
...
Hi folks,
I'm just playing with some linq and asp.net - absolute beginner so I'm not even sure exactly how to ask my question.
Anyway, I have a MSSQL database with asp membership info in it. For various reasons (mainly to store profile info in clear columns instead of all in one) I'm using a custom profile provider so my profile inform...
I have a table with 40 (int) columns and I need to get certain columns depending on user input, sometimes it might be 1 and some other times it might be all 40, how can I do this using LINQ?
...
Even a simple query like
EmmaDatabase.EmmaDB ec = DatabaseProvider.GetEmmaDatabase();
var changes = (from o in ec.dbCachedChanges
select o);
Throws me an ArgumentException (Argument types do not match) while iterating over it. The Stacktrace only contains
at System.Linq.Expressions.Expression.Bind(MemberInf...
Post Edited
Would this be possible ?
Have a query expression that is precompiled
i.e
private static Func<SmwrDataContext, int, IQueryable<Xyz>> _validXyzs =
CompiledQuery.Compile((Context context, int Id) =>
from xyz in _db.XYZs
join abc in _db.ABCs on xyz.Id equa...
According to the answer to this question, there is no way to effectively use LINQ for IO bound tasks. Is there a way to gain better control, or is LINQ just not suited for such tasks?
...
Hi, I'm new to ADO.net data services (and to .net in general too..), I'm having this project where I need to setup a data service to read and write to a database with nHibernate, I've created the service:
[WebGet]
[SingleResult]
public Factory Factories(int Id)
{
try
{
Factory[] results = this.Cur...
I have a recipe table that has a related ingredients table
on one to many basis.
How do I select using Linq ingredients
that have a ingredientName column and it should contain
a specified word.
This is what I tried.
IQueryable<OurRecipes.Domain.Linq2Sql.Recipe> recipes = _dbctx.Recipes.AsQueryable();
foreach (string word in sear...