I'm pulling my hair out on this one. I'm trying to implement a ADO.Net Data Service that uses a Linq to SQL data context. I thought I had it working, but the URL for one of my tables always gets an exception.
The obvious difference between the table that isn't working and the ones that are, is that the one getting the exception is usi...
Hi,
I am calling a stored procedure through LINQ-to-SQL (yes, I know it's deprecated). I am getting back an error, but the IExecuteResult only seems to be able to provide me with a number, when I would like the full string error description (like what you would get if you executed the SQL by hand in SQL Management Studio). Alternatively...
Hi folks,
I need to display a history all our Products we've sold by day, week, month and year. This data will be sent to google charts API to display a line graph of the results.
So if i have a table called Products and it looks like:-
Products
ProductID INT
DateCreated DATETIMEOFFSET
and the user asks to see the history for Produ...
Quick question,
I have a call to a sproc which can return any number of the same resultset.
I have a loop which knows how many are going to be returned at one time, this works great.
Inside the loop it uses getresult() and transforms the data into the specified type say . This seems to work but when it comes to displaying the data on...
Thanks to this website I succeed to use a connectionString localized inside a web.config instead of the one provided in the app.config of the library. But my production and my test SQL Server do not have the same SQL user name.
Table(Name="SqlUserName.tableName")]
public partial class tableName : INotifyPropertyChanging, INotifyProperty...
I would like to extend a class generated by Linq To Sql to initialize when a new object (=row) is created.
I want to add rows to a child table when a parent row is created.
I was hoping to use the Oncreated (partial) method do something like this:
partial class Product {
partial void OnCreated() {
// Fill default rows for...
Hi
I have a setup where I used Linq2SQL inheritance. To make queries easier, I expose the derived types in the DataContext as well, like the following:
public IQueryable<Derived> Derivations
{
get { return Bases.OfType<Derived>(); } // filter list on type
}
Calling this works perfectly, and I can see the SQL being correctly genera...
Some background: I have an database that I want to use linq-to-sql to update through a C# application. One of the columns in this table has an XML datatype.
Every other column in that table (that isn't of an XML datatype) updates perfectly fine, but when I went to make changes to the XML field, the program executes (seemingly) correctl...
I am working on a web service for creating, changing and removing hotel reservations (bookings). One booking can contain several stays (a stay is a link between a room, the services ordered, etc.). Each stay has it's own time period, so you can create 3 stays in the same booking, for 3 different weeks.
My problem arises when bookings ne...
First, here is a picture of the relevant part of my database schema:
I have several conceptual queries of increasing complexity. Currently, I am doing these with a series of SQL queries (i.e. many back-and-forth trips from the C# code to the SQL Server), and I'd like to find a way to get these each in a single query, but doing so is ...
Title says it all. I want to be able to work with system stored procedures (sp_helpXXX etc) through generated Linq-To-SQL or Entity Framework wrappers. Problem is, system sprocs are not listed in the generation wizards. I have also tried running sqlmetal.exe manually, but no system stored procedures show up.
...
I'm using Linq to SQL with SQL 2005. I'm parsing a large fixed width file and importing the data into SQL via custom entities that I have mapped to the database using property attributes.
The program runs for about 240 records before throwing this error. I've checked the columns (all four of them) and the data it's trying to put in and ...
I'm trying to go through the NerdDinner example chapter from the ASP.Net MVC 1.0 and I've come across an error. Everything was hunky dory until I got to the part where I need to edit a dinner. I've followed the guide word for word from the creation of the project until this point (at least the best I can tell). However, when I call th...
So with LINQ-to-SQL I know you can update the database from the LINQ objects and update the LINQ objects from the SQL.
I am using LINQ's entity framework (a.k.a. LINQ-to-entities) and I can update the entities from the SQL database, but I can't update the database schema by changing the entities.
This is frustrating. Is there somethin...
I have a website project, and using Linq to SQL in it. Currently, I have my .dbml file in the App_Code directory, but I want to separate it out into a different project in order to compile it into a separate dll; is it possible?
I tried adding a DB project to my solution, but didn't have much luck with it.
...
Hi,
Bumped into a strange situation here. Trying to extract cars from a sql database within a certain range of a position (lat/long) and return an IQueryable to do additional logic on the resultset afterwards.
public IQueryable<Car> QueryAllCarsByDistance(float latitude, float longitude, int distance)
{
var cars = from car in Query...
Well I've been reading a couple of posts on this here on Stackoverflow but I'm still not not sure about the direction to take.
Basically I'm developing a product which I will maintain for the next 10 or more years so I want to decide now as to which framework to stick with.
So I need expert advice as to which framework I should adopt t...
I have a table with a nullable field of type text. When I run an InsertOnSubmit(), it inserts successfully but all formatting is lost. Specifically, I'm storing the stack trace of an error. Each entry has been formatted into its own line and it looks nice, but when I retrieve it from SQL it loses all its crlf4's.
I have other text fiel...
In my project many tables are linked to aspnet_Application table by ApplicationId foreign key. I don't want the users to view or edit it, so I'm looking for way to preset this sql table field value before the insert query is executed. I still have scaffolding enabled for this column (in order for DD to generate the right sql script) but ...
Let's say I have this SQL:
SELECT p.ParentId, COUNT(c.ChildId)
FROM ParentTable p
LEFT OUTER JOIN ChildTable c ON p.ParentId = c.ChildParentId
GROUP BY p.ParentId
How can I translate this into LINQ to SQL? I got stuck at the COUNT(c.ChildId), the generated SQL always seems to output COUNT(*). Here's what I got so far:
from p in con...