linq-to-sql

LINQ query to get All objects information from given database in ASP.NET?

Hi All! I have a requirement that, I populate all database in one DropDownList and when i changed the database name. I need to display all objects present in the database into a gridview. I need to do it in LINQ to SQl could any one please help me to solve this problem? Thanks and Regards, G. Kiran ...

Getting a blob size without the blob itself

I have a table that has a blob column representing a file. I'd like to run a LinqToSql query that returns a name and description of the file, along with the file size... but in the interests of not killing performance, I obviously don't want to download the whole blob! var q = from f in MyFiles select new {f.Name, f.Description,...

Removing FK when there are no related record (linq-to-sql)

Problem I got two related tables, with a foreign key that doesn't enforce FK contraints. The "child" table should be allowed to specify a "parent" key, which is either NULL or non-existing ID. My data access is built using Linq2Sql and it generates a one-to-many relation in the model of my tables. The problem comes in some cleanup cod...

How to use "with(nolock)" in Linq to SQL?

we can use sql just like this:select * From Student with(nolock) how can i impl this in Linq to sql? Note:I don't want to use TransactionScope expect your answer ...

linq to sql and inheritance question

Does anyone know how to to get the inheritance code for a specific type (single table inheritance in Linq to sql) ? When I create a new entity B (which is inherited from A), I would like to write some code in A, that is valid for all objects inherited from A. However, when you create a new entity B, it's inheritance code is not yet fil...

Linq-To-SQL Code Generator - How to Modify the Template?

We're using Linq-To-SQL in one of our projects, and I like to modify the template the code generate uses to add some Code Analysis suppression attributes. Anyone know how I can do this? ...

Dataset and SQLCe in .net 4

I'm trying to build a SQLCe table structure dynamically using a dataset as the temporary table structure... Is there a SqlConnection string that will work with SqlCe? There used to be a SqlCeConnection...but I don't find that in the 4.0 framework? Has something replaced this? If the answer is L2S or Entity Framework...can I add colum...

LINQ-to-SQL Update not working correctly

I have the following simple data model: Resource { ResourceId ResourceName } UsageType { UsageTypeId UsageTypeName } Usage { UsageId UsageTypeId ResourceTypeId Percentage } When I change the UsageTypeId, ResourceTypeId and Percentage values on a Usage object and then issue SubmitChanges() LINQ-to-SQL only iss...

How to handle encrypted column in SQL Server Database in LINQ to SQL?

Hi Guys, We are in the process of encrypting all the SSN columns (had to do it now due to security audit). We already built the DBML and now we have to change it. Can you guys let me know if there is a good way of handling this in LINQ to SQL? We use stored procedures for Insert, Update and Delete but use LINQ to SQL for all our selects...

C# handling result sets from SQL Server

Hi, I have large wait times in ASYNC_NETWORK_IO on my SQL Server and I found this interesting article http://blogs.msdn.com/joesack/archive/2009/01/09/troubleshooting-async-network-io-networkio.aspx the part i find interesting is: Identify large result sets and verify with the application team (or developers) how this is being cons...

collation conflict

Is there any one who knows how we can solve collation issue in select linq query? I'm getting this error when I want to select data in linq. Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation var lstData = from s in dataTrackDB.datas join b in...

ASP.NET MVC 2 | Linq To SQL | Many to Many Checkbox Management

I'm using the L2S designer to generate classes from my DB. The app is your average blog kind of thing. I have a many to many relationship between Posts and Topics with a table PostsTopics that links them. When editing a post I'd like to display a checkbox for each topic and pre-check the ones for which there are values in the PostsTop...

MVVM with WPF using LINQtoSQL in a DAL along with a BLL

Hey guys I'm hoping someone can get my pointed in the correct direction regarding these new technologies. I'm still in college and unfortunately our school doesn't teach any proprietary technologies(ex. MSFT). I've got decent experience with C# however when it comes to an enterprise level app with all this new stuff, I'm a bit lost. My...

Linq to SQL writing translatable functions

I'm pretty sure the answer to this is "you can't do that" or "No, no, you misunderstand...", but: I have a linq class, thing, which will happily execute this: var thingsWithAandB = from t in db.things where t.propA.HasValue && t.propB.HasValue select t; But I do this a lot, and so I wan...

How to specify a entity in SqlToLinq not to do update in database.

Hi. Iam using LinqToSql togheter with an XmlMappingFile so a can use POCO. I have an entity that is called Address. And in this Entity I have entity called Country. This entity is populated from database, but that table should never be changed since it has a list of all countries and is "Hardcoded". I have a Club entity that has a lis...

SQL Query to Linq GroupBy and Max

Here is a SQL query that I am trying to convert in to Linq. I am using a generic list of objects and not a DataTable if that is relevant. Select Max(Date), ID, Property1, Peroperty2 From List Group By ID Please help. ...

LINQ to SQL: Create a dettached entity object

I have generated few classes using to LINQ to SQL one of them being "Customer" Now I want to create a Customer object that is disconnected. i.e. I can create the object keep it in session and then attach it back only if I want to. Not automatically. Hence only if I attach it - it should affect my context's SubmitChange() otherwise no...

LINQ composition - generates a weird FROM clause

Possible Duplicate: Why did the following linq to sql query generate a subquery? I have a qs. for you LINQ gurus... I am using LINQ in a composable way and the SQL being generated is a bit complex and of the form: SELECT xxx FROM ( SELECT yyy from myTable1, myTable2 WHERE foo == bar ) AS t7 WHERE t7.column == value. ...

linq to sql designer in .net 3.5

hi, where can i find the linq to sql designer in .net 3.5 sp1? do i need to install something to work with it ...

ADO.NET Entity Framework and LINQ to SQL

Hi, Can anyone answer my question? We are deciding upon the implementation of our Data Access layer. Initially we were working with NHibernate but now there is a change, so please answer my question... IS LINQ to SQL a part of the ADO.NET Entity framework or is it a separate library? If I say I am using "LINQ to SQL" for ...