hi, i am attempting to update approximately 150,000 records in a table in SQL 2005 using linq2sql. When it comes to xx.SubmitChanges() it is taking about 45 minutes.
I am running sql as a local instance on a quad core pc.
Does anyone know why this is taking so long? or is that normal?
Code Sample:
var y = db.x.Where(j => j.NumberOfOr...
I try to write some codes about Generate list from Anonymous type via below codes :
public static List<T> MakeList<T>(T itemOftype)
{
List<T> newList = new List<T>();
newList.Add(itemOftype);
return newList;
}
But ERROR return me:
A primary key field specified via the
KeyFieldName property is not found in
the underl...
Hi !
I'm a newbie with the IQueryable, lambda expressions, and LINQ in general. I would like to put a subquery in a where clause like this :
Sample code :
SELECT * FROM CLIENT c WHERE c.ETAT IN (
SELECT DDV_COLUMN_VAL FROM DATA_DICT_VAL
WHERE TBI_TABLE_NAME = 'CLIENT' AND DD_COLUMN_NAME = 'STATUS'
AND DDV_COLUMN_VAL_LANG_...
I'm getting this error when using LINQ2SQL:
The query contains references to items defined on a different data context.
Here's the code:
var instances = (from i in context.List
join j in context.CatsList on i.ListID equals j.ListID
join c in context.Cats on j.CatID equals c.CatID
...
Hello SO,
I'm using LINQtoSQL to create cascading deletes IE: if Category is deleted then all the Products in that category are also deleted.
I have a Products repository set up already (IProductsRepository) and now I'm working in my Category repository to add the business domain logic for the cascade.
Products repository has this met...
What im trying to do is search thru multiple tables (that are kind of unrelated) and everytime it finds a match - create a new more generic "Results" Type
for everytable - concat this result type set. The error i get is: All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their t...
i have the following working query in mysql...
select * from events e join performance_times pt on e.id = pt.event_id
where pt.performance_date_only > '2010-08-10 00:00:00'
group by pt.performance_date_only
I am having issues getting the group by to work when using this with my edmx file in my mvc app.
I have it working with the jo...
I seem to be having trouble with this. I have a Task table with an ID, and a Tag table, that has a tag field and a foreign key constraint to the task table.
I want to be able to perform AND searches for tasks by tags. So for example, if I search for tasks with the tags "portability" and "testing", I don't want tasks that are tagged ...
I have a solution where i have 3 WPF projects under it(Project UI-A, Project UI-B and Project named CommonLibrary(Data Layer).I have a user registration form in the Project UI-A where i will capture the User profile information.And in the CommonLibrary project i have a class called "UserCommon" which will have a method to save the data t...
I am using LINQ To SQL and calling stored procedures to insert the new rows.
Does the code below demonstrate an appropriate set of steps?
I want to insert (other fours) only if all four inserts are passed otherwise rollback all four inserts.
public bool InsertNewInquiry(Inquiry inq)
{
using (var transaction = new TransactionSco...
Being new to Linq-to-SQL, I ran into one of it's Gotchas today and I wanted to share my solution and then ask if there was something better.
I'm setting up a staff allocation tool for my work. There are three basic class/tables: Employee, Project, Assignment. Importantly here, Assignment serves as a junction table between Employee and...
I'm new to linq-to-sql (and sql for that matter), and I've started to gather evidence that maybe I'm not doing things the right way, so I wanted to see what you all have to say.
In my staff allocation application I allow the user to create assignments between employees and projects. At the beginning of the application, I open up a linq...
Hi,
Recently i implemented Linq to SQL in a static class in my ASP.Net project which is a utility class to get some information on site load. when i used the static linqtosql datacontext i got the above error only in the live environment but never got that issue on UAT, or QA sites. ( this means this issue only happens when there is a m...
Quick question regarding Automapper.
I'm mapping data from an incoming web service, where datetimes fields are not null, but sometimes have the value of DateTime.MinValue as a work-around (I don't own this service so I'm at their mercy I'm afraid). I'm mapping from those objects to Linq To Sql objects created off of a db model I create...
Help! My fingers are falling off from typing so much.
I have a lot of objects that have sane names to them. The Database names are not so sane, and i'm stuck defining my property names in all my projections.
For example:
from f in foo select new MyClass() {MyID = f.ID, MyName = f.f, MyTime = f.t}
Etc.. now, multiply this by hundr...
Hi everybody!
Please help me solve my big problem.
in my on-line shopping project i created a dynamic Category List (with Infinite Level Depth) Implemented in a Single Table in DB with Self join.
the schema is like below:
Update
I want to use a JQuery plugin to make a Multi Level Menu bar. this plugin uses <ul> and <li> elements so I sh...
Much has been written about the difference between SQL Server, Unix, and Microsoft OLE Automation Time epochs. SQL Server treats 1/1/1900 as the epoch, while OLE treated it as 12/30/1899 for various reasons. I've read all the history, and it's fascinating, but doesn't help me solve my problem.
I find myself writing a lot of queries on...
Hi, I am using linq to sql in a Silverlight application and I keep getting this debug error..
http://www.freeimagehosting.net/uploads/bf4055b4ee.jpg
This code runs when the application is started up without problems. When I call it the second time, I only get a few of the results. When I add a breakpoint to the WCF service I get the fo...
Hi,
We are working on improving our DAL which is written in LINQ that talks to the MS SQL database. Our goal is to achieve good re-usability with as little code as possible.
LINQ generated files are making a use of generics and reflection to map LINQ generated classes to the SQL objects (tables and views in our case).
Please see the e...
I have a public method called LoadContact() in the Contact class. I want to load the contact data using Linq and assign the values to 'this' instance.
So far I have .....
var contact = (from cont in db.Contacts
from note in db.Contacts_Notes.Where(n => n.ContactID == cont.ContactID).DefaultIfEmpty()
where cont.AccountID == thi...