This kind'a sucks. If I connect to a SQL Server DB (.mdb file) through VS.Net's server explorer, then I can't connect to the same file via SQL Server 2008 Management Studio at the same file. The file is locked.
For example, I get the following error from SQL Server Management Studio
CREATE FILE encountered operating
system error ...
Hi,
I am using LINQ to SQL in an ASP.NET project. While inserting the table I need to convert the values to the particular table object and I need to insert.
For that I created a new constructor in that table with parameter so that I can assign my value to that table object , the assign the functionality is working but while inserti...
Hello, I have a Question table which joins to a Solution table. The solutions are linked to the questions but in order to delete a question, i must delete the solutions for that question first and then delete the question itself.
I have a linq query that retrieves all solutions for a specified question however i am unsure how to proceed...
Is it possible to add the "DeleteOnNull=true" on a custom class instead of modifying the DBML (generated) class directly?
For example, let's say this is a part of my generated dbml class:
[Table(Name="OrderDetails")]
public partial class OrderDetail :
INotifyPropertyChanging, INotifyPropertyChanged
{
// deleted for brevity
...
I have 14 LINQ queries to resolve in one method. None of them have a base query that I could hang them from as subqueries and then store the results as properties of an anonymous type instance.
Rather than making 14 separate calls to the database, how can I ensure that they are all called in the same operation?
UPDATE
I ended up using...
I was messing around with LinqToSQL and LINQPad and I noticed that SingleOrDefault() doesn't do any filtering or limiting in the generated SQL (I had almost expected the equivalent of Take(1)).
So Assuming you wanted to protect yourself from large quantities accidentally being returned, would the following snippet be useful or is it a...
Given this schema:
Fruits
- FruitID INT PK
- FruitName NVARCHAR(30)
- FruitStatusID INT NULL FK: Statuses
Statuses
- StatusID INT PK
- StatusName NVARCHAR(30)
If I have a FruitID in hand (just an int, not a Fruit object), how do I update the FruitName and null out FruitStatusID without loading the Fruit object ...
I'm looking to learn LINQ, but I'm finding that there is a lot more to it then what I initally expected. In fact, there's so much that I'm not sure where is the best place to start. I know that there's LINQ to SQL, and LINQ to Entities, and a number of other LINQ whatevers out there.
Which is the best to start with? It seems that I see ...
I am trying to bind a ComboxBox to a foreign key table. I know that on cannot bind to the actual foreign key, SomeTableClassFK, (causes a LinqSql exception when the FK already has a value). So, I am binding to FK object, SomeTable, reference thru the SelectedItem property of the ComboBox.
SomePrimaryTable
SomeTableClassFK ---> SomeT...
My problem is this:
We have a very large Legacy DB with many SPROCs, Views & Tables.
The Designer is a "NO GO" b/c of the size.
I've configured SQL Metal to build the data context, but the resulting code file is so big (12MB) visual studio 2008 will not open it.
If SQLMetal would generate a new file for each class type (Table, View,...
I am using .net Reactor to obfuscate a data layer assembly containing LinqToSql classes. On invoking the assembly, i am getting the following error..
Bad Storage property: '_ApplicationId' on member 'RCSQLData.Application_DB.ApplicationId'
I am using the 'Library' mode and have enabled 'Necrobit' and 'obfuscation'.
Is it possible to ...
Hello All,
I have a procedure in SQL that I am trying to turn into Linq:
SELECT O.Id, O.Name as Organization
FROM Organizations O
JOIN OrganizationsHierarchy OH ON O.Id=OH.OrganizationsId
where OH.Hierarchy like '%/12/%'
The line I am most concerned with is:
where OH.Hierarchy like '%/12/%'
I have a column that stores the hierarch...
My strategy was to keep the project's layout clean. Given that this is a datalayer project, and I'll have a class file for each concerned entity, I thought I would put the .dbml into its own directory. It turns out that locating your .dbml file within a subdirectory turns it into a lower level namespace of sorts.
This is a C# class libr...
I come from the asp.net world where we'd use an objectdatasource, hooked up to data access layer, and set it's ConflictDetection property to "CompareAllValues". There is an OldValuesParameterFormatString on the ObjectDataSource that you use to identify old value parameters.
The sql procedure that does an update would then require both n...
EDIT 1
I apologize but after reading the 2 suggested articles I still don't understand what I should use. I understand that using IQueryable is not preferred for various reasons but does that eliminate IEnumerable as well? Is a DataTable really my best option?
In short, I guess, what is the preferred Return type?
I have the followi...
Our team is now beginning to look at jumping from 2.0 to 3.5 and have been reviewing all the new stuff....
So, with the whole Linq to SQL not being heavily improved in the future should we ignore it completely?
It seems that it may fit of our needs very well BUT I imagine so could entity framework even if it may add more complexity.
S...
Hi All,
I have a little project, it is using LINQ and SP, I would like to create a response class which return information after i called SP.
I saw on this page a solution (http://stackoverflow.com/questions/307656/rollback-a-stored-procedure-call-from-inside-a-transaction-using-linq-to-sql) but i don't know how look like this Response ...
My application keeps running into Timeout Expired SqlExceptions. The thing is that this query is one that will simply have to run for a decent amount of time. I'm having trouble figuring out where this exception is occurring though. Is this a timeout that's created at the database server or is it happening in my program? Or if it cou...
I've hit on the idea of creating static methods on the partial Linq queries such as
public partial class User
{
public static User FindByGuid(string guid, ApplicationDataContext context)
{
return context.Users.Where(x => x.GUID == guid).Single();
}
}
So, for example, I can easily find a user by doing:
using (var c...
I use linq 2 sql for my ORM.
For performance reasons, I serialize some of them, and throw them into memcached.
When they're deserialized, they're of course not attached to a datacontext, which is 100% fine, as they're only used for reading from in those scenarios.
For sanity reasons however, I'd like to be able to tell whether a gi...