linq-to-sql

Accessing MYSQL database using LINQ in asp.net MVC

hi I want to use MYSQL database for accesssing the data in a mvc application. The connection string that i am using in web.config is: Then I have prepared a model,controller,view for accessing and displaying the data. I am using LINQ o get the data from database but getting the exception:" A network-related or instance-specific er...

Generic LINQ TO SQL Query

Lets say I have two L2S classes generated by the designer with one property as follows: public class A { public bool IsActive {get;set;} } public class B { public bool IsActive {get;set;} } I have a generic DataAccess class as follows: public class DataAccessBase<T> where T : class { NWDataContext dataContext = new ...

Object is reinserted into database immediately after delete (DbLinq)

I have a MySql database, whose general structure looks like this: Manufacturer <== ProbeDefinition <== ImagingSettings ElementSettings ====^ ^==== ProbeInstance I'm using InnoDB to allow foreign keys, and all foreign keys pointing to a ProbeDefinition have set ON DELETE CASCADE. The issue I'm having is when I delete a ProbeDefinit...

at what point does linq-to-sql or linq send a request to the database.

Hello =) I want to make my queries better but have been un-able to find a resource out there which lays out when a query is shipped of to the db. DBContext db = new DBContext(); Order _order = (from o in db where o.OrderID == "qwerty-asdf-xcvb" select o).FirstOrDefault(); String _custName = _order.Custo...

LINQ to SQL : Need Different Usernames for Prod and Dev DBML On Table Attribute

This is a similar problem to this question When I deployed my dev app to the prod server I was getting an error: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Login'. The table attribute on the linq mapping looks like [Table(Name="dbo.Login")] When I loaded the prod db schema into the vs2008 server explorer and refresh...

Linq Logical Delete with associations

Hi, I am trying to implement a logical delete senario across all my entities. All have an IsDeleted boolean property. I would also like to cascade the association deletes also. I started by adding a partial method for the entity to the datacontext. partial void DeleteQuestion(Question instance) { instance.IsDeleted = true; Exec...

LINQ to SQL and Windows Forms Binding.

Could anyone suggest the proper way for binding LINQ to SQL queries in Windows Forms controls? Should i follow the standard way with BindingSource and handle the events to have change tracking while various values changing from the controls. This kind of binding will involve hierarchical object binding too, EntityRef<>, EntitySet<>. Now...

Why would LINQ all the sudden start acting strange with DB connection

This is an odd one. All the sudden when I create LINQ to SQL projects in Visual Studio would it not create the following line in the designer, up to three weeks ago or so, it used to create this line, now I have to manually do it. Then if I make changes in the dbml file it removes it and I have to manuallhy add again. huge pain. Here is ...

linq to sql vs ado.net entities

If I am using SQL Server as my database service, is there any compelling reason to look at LINQ to Entities over Linq to SQL? ...

How SQL Server processes simultaneous requests?

If multiple queries to one and the same large table come to SQL Server at the same time, how SQL Server resolves conflicts in this case? When using LINQ to SQL queries in WPF application for install on many PC's, working in network with SQL Server database, should I somehow implement mechanism for resolving such issues or am I protected...

LINQ One to Many, 3 levels Deep Question

I am trying to figure out what I am doing wrong in the below LINQ statement. It doesn't like the third SELECT. It finds tblAddresse.tblAdminCounty in Intelisense when I am typing the query but when I type the SELECT after it it freaks. Does it have to do with how tblAddress and tblAdminCounty are related? I would have thought that ...

How to create breadcrumbs using Dynamic Data/LINQTOSQL framework?

Hello, I need some EXAMPLES or IDEAS on how to created dynamic breadcrumb control which will dynamically generated breadcrumbs for Dynamic Date framework powered by LINQTOSQL ...

LINQ, Should I JOIN or use nested SELECT NEW's

I have to below 2 LINQ statements. They both return (seemingly) the same result set. Can anyone explain to me why I should use one way versus the other? Is it as simple as "You say potato, I say potato; you say tomato, I say tomato"? Here are the two flavors of LINQ --> 1) The two lets below are to private Methods that take an ID an...

Writing Lamdba Query Expressions in VB.Net using linq to sql provider

I'm just not understanding on how to create a lamdba expression instead of using a regular comprehension linq queries. All of the examples i see are not query a database using linq to sql. i want to able to construct a lambda expression that get my the orders from the northwind database where the country equals "us". I know how to constr...

How do I get textarea for Html.EditorForModel() method in asp.net mvc 2

Somebody knows the answer? I'm using L2S with field ntext in my db ...

Error, method not supported by LINQ to Entities

Why I am getting this error: The method 'Single' is not supported by LINQ to Entities. Consider using the method 'First' instead. public ActionResult Details(int id) Line 27: { var result = (from d in _db.MovieSet Line 29: where d.Id == id Line 30: select d).Single(); // ...

What database vendors does LINQ to SQL support?

I'm kind of new using LINQ to SQL and when ever I try to use a non sql server dbs I get an error that it is an unsupported data provider. Is there a way to get LINQ to work with dbs like Oracle and SQL sdf files? ...

How to achieve different types on joins with LINQ..?

On Sql server we have multiple joins viz. left outer join, right outer join, full outer join, self join Can anyone given an example each on LINQ..? And how to achieve the same result with Extension methods...? ...

How do you make SubmitChanges only submit a particular change and not all previous changes?

The ASP.NET linq SubmitChanges method commits changes for all previous database modifications since the last time it was called. I have a case where I do something like the following: ClassX x = new Abc.Linq.ClassX(); DataContext.InsertOnSubmit(x); ClassY y = new Abc.Linq.ClassXY(); DataContext.InsertOnSubmit(y); DataContext.SubmitCh...

omit nullable types in linq-sql query

I have some code like this trying to get some data from a Documents table based on some filters passed in (ContentRef and TypeRef)... public IQueryable<Document> GetFilteredDocuments(bool archived, int? ContentRef, int? TypeRef) { return from document in db.Documents where document.IsA...