Hi!
How can I configure LinqToSql to make an "On UPDATE CASCADE"? In Sql Server all my constraints are set to make this cascade. But, when I try to update my PK via application, Linq doesn't allow.
Is there a rule to make that?
Thanks!!
...
Hi all,
i am investigating into the way LINQ gets mapped to SQL, and I have some troubles getting a simple thing.
There is a table sessions that holds one row per user login. Consider the following SQL
SELECT COUNT(*) AS c
FROM sessions
GROUP BY sessions.user_id
ORDER BY c DESC
I am using LINQPad to test LINQ-to-SQL transformations....
Hello,
I'm creating a silverlight 4 application (using the Business Application template). I generated Linq to SQL classes for my tables in the .web project and want to use RIA services. When I add the domain service class to the .web project the data context for the Linq to SQL classes isn't available to choose.
According to the doc...
I want to update the only field of entity when I know entity Id.
Is it possible in LINQ to SQL without retrieving full entity (with all fields from DataContext that is overhead) ? Is it possible to create and attach entity to DataContext and mark the exact field(s) to synchronize on DataContext.SubmitChanges (or something like that)?
...
Is it possible that after closing a transaction scope, we can obtain an array of ids containing all the ids inserted inside that transaction scope?
If yes, how?
...
I have a perplexing SQL select statement (ugly) that I'm trying to write in LINQ. I'm working to get a single statment that will execute, not pre-selected data into lists that I have to send back to the server.
DECLARE @StartDate DATETIME ;
DECLARE @EndDate DATETIME ;
SET @pStartDate = '20100501'
SET @pEndDate = '20100531'
SELECT r.com...
Hi,
When working with Viewmodels from linq to sql I have an architectural problem.
When you have an object from your db (let's say "person"), and you load it in your viewmodel. After this in your view, when you try to acces referenced classes (let's say a person has children object which is a different table in db, and a different data...
I have the following table structure in my database:
create table Encargado(
ID int primary key,
Nombre varchar(300),
)
create table Area(
ID int primary key,
Nombre varchar(300),
Jefe int foreign key references Encargado(ID)
)
create table Carrera(
ID int primary key,
Nombre varchar(300),
Area int foreign key references Area(ID)
)
c...
i want this bellow syntax write by useing the lamda expression
from p in this.Context.tblUserInfos
where p.Status == 1
select new {p.UserID,p.UserName,p.tblUserType.UserType };
suppose i write
this.Context.tblUserInfos.Where(p => p.Status == 1);
How to write the above syntax by using the => operat...
Im not able to add System.data.datatableextensions as reference and also not the method CopyTODataTable is not getting recognised.
Thanks and regards,
Veena
...
I cant see the System.data.datatableextensions in the reference list and hence not getting intellisence for CopyToDataTable method to return dataset from linq through aweb service.
...
What changes do i need to make so as to reduce of doing this task with fewer lines and better approach.
DataTable dtStatusMsgs;
var statusList = (
from items in dtInputTable.AsEnumerable()
where items.Field<int>("DepartmentId") == deptId
select new
{
...
Say I have the following Linq 2 SQL command;
ItemsRepository.All().Where(r => r.type == "myType");
Let's say it returns an object collection of;
id
title
description
type
etc
Is there a way to return the entire object and trim the description to the 1st 200 chrs if there are more than 200 chrs in the description?
Or should i ge...
Is it possible to insert only 100 records at a time per transactionScope?
I would like to do things that way to avoid timeouts on my application.
using(var scope = new TransactionScope())
{
foreach ( object x in list)
{
// doing insertOnSubmit here
}
context.SubmitChanges();
scope.Complete();
}
So I would...
Hi All,
I am using LINQ to SQL (SQL Server) with C#.
I have a table called "Cars" which automatically becomes the LINQ class/object called "Car".
All well and good.
Each car has a number of fields, say CarID(primary key int), EngineID, ColourID.
I have 10 existing rows in the Cars table.
Using all the cool LINQ stuff, I create a new...
hi, i have a query like below and i want to update all elements of sequence. but without using foreach/for
var res = _context.tbl1.Where(/* Conditions here */);
res.//Using a method to performing changes;
...
I'm building ASP.Net MVC2 application on top of a legacy database. Every table in the database includes an id that defines to what organization it belongs to. Like:
| id | name | org_id |
| 1 | John | 4 |
| 2 | Joe | 4 |
| 3 | Anne | 2 |
Now, user "John" should not see Anne from another organization e.g. get that ro...
Given the following classes:
class Order
{
public int Id;
public string OrderNumber;
public DateTime OrderDate;
}
class OrderItem
{
public int Id;
public int OrderId;
public string ProductName;
public decimal Price;
}
class OrderComment
{
public int Id;
public int OrderId;
public string Subject;...
I've several databases that contains the exact same base tables with identical design. Now I need to be able to access a base table from any one of those database.
Is there any way to create a common interface that can still utilize the power of Linq2Sql? I was thinking that I would have a factory that created a data context for that ch...
I am almost done converting a MySQL app to Linq2SQL but struggling to get my head round this last SQL query
SELECT a.URL, b.URL AS DuplicateURL
FROM Pages a
INNER JOIN Pages b ON a.MetaDescription = b.MetaDescription
AND a.PageID <> b.PageID
WHERE a.DomainID = @reportid
AND b.DomainID = @reportid
AND LENGTH(TRIM(a...