Hello all,
I'm using linq2sql in my asp.net app. When using it with linq2sqldatasource object everything works, i mean i bind it without no code to a detailsview control.
My idea is when i click a row in the detailscontrol e will load/add to the same page a customwebcontrol that will permit edit the data.
For that i need to load some i...
Hello All,
I am having a lot of fun with Linq2Sql. Expression Trees have been great, and just the standard Linq2Sql syntax has been a lot of fun.
I am now down to part of my application where I have to somehow store queries in a database, that are custom for different customers that use the same database and same tables (well, view, ...
Lets say I have a Customers table and an Orders table with a one-to-many association (one customer can have multiple orders). If I have some code that I wish to unit test that accesses a specific customer's orders via lazy-loading (e.g. a call to customer.Orders), how do I mock / stub that call out so that it doesn't hit the database?
...
Is it possible to show the SQL that was executed for a particular request in an ASP.NET MVC app? I would like to show how many queries, and what they were on the bottom of pages during debugging.
...
Hello everybody!
We are writing this paper about database access in a web app and have to distinguish between the different categories of the database access layer.
All books and PDF's given us provide only information to JDBC or OLEDB.
Researching on the web brought me to the point that access to a Microsoft SQL Server trough linq-to...
When I want to Insert data in my table this Exception appeared
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Message_Subject". The conflict occurred in database "C:\DOCUMENTS AND SETTINGS\TEHRANI\DESKTOP\MESSAGEADMINPAGE\APP_DATA\ASPNETDB.MDF", table "dbo.Subject", column 'ID_Subject'.
The statement has been t...
What is the Linq equivalent for row locking hints in SQL? For example:
select *
from MyTable with (updlock)
where MyField like 'A%'
Or is the whole question moot, because Linq caches all the objects anyway and it can't handle concurrent updates to an object already residing in memory?
...
We are using LINQ to SQL to work with database in our project and almost all is fine but one thing: sometimes we have to build a huge WHERE condition using some universal query object which is built by user input.
To build the predicate to put in WHERE statement we used tricks explained here http://www.albahari.com/nutshell/predicatebui...
Is there a way to force LINQ-to-SQL to treat a column as dirty? Globally would suffice....
Basically, I've got a problem with some audit code on a legacy system that I'm talking to with L2S, imagine:
var ctx = new SomeDataContext(); // disposed etc - keeping it simple for illustration
var cust = ctx.Customers.First(); // just for illus...
I have 2 views in SQL set up:
PurchaseOrder
PurchaseOrderLineItems
These have many columns aliased (the tables they view/join are not sensibly named... it's a 3rd party product)
I have 2 classes (simplified below)
class PurchaseOrder
{
public string PoNumber { get; set; }
public string Vendor { get; set; }
...
Hi - I have a object:
public class ForumTopic
{
public Guid ForumTopicId { get; set; }
public Guid OwnerId { get; set; }
public Guid CategoryId { get; set; }
public DateTime CreatedDate { get; set; }
public string Topic { get; set; }
public bool IsSticky { get; set; }
public bool I...
I have been doing this:
public List<Role> GetRoles()
{
List<Role> result = new List<Role>();
foreach (var r in Db.tblRoles)
{
result.Add(new Role()
{
Description = r.d,
Id = r.Id,
Responsibility = r.Responsibility
});...
I need to update all the properties in a list object using linq.
For ex.: I have an User List with (Name, Email, PhoneNo,...) as properties.
I will get the Users List(List<Users>) from database which is filled with all properties except Email. I need to update all the Email property in the list after retrieving from database with some...
I totally can't get my head around writing a correct query for my problem this morning so here's hoping that someone out there can help me out.
I have a database table called Sessions which basically looks like this
Sessions:
SessionID
SessionStarted
IPAddress
..other meta data..
I have a requirement where I am to show how ma...
I'm using visual basic 2008 express edition by linq to sql for my database operation such as edit records. I did not use any sql server but I'm just using the built-in sql server within the visual basic 2008 express. I tried to revised the codes, no error in syntax but there's an error at runtime and it pops-up a window message saying it...
Hello,
I'm new to Linq and Visual web developer 2008 Express. I have read some posts here and Scott Guthrie's on setting up Linq, but I'm a little stuck because the classes aren't auto-generating as I thought they would. I have setup a database with a simple table (with the Primary Key as the ID, and it is set to auto-increment) plus ...
I have a GridView bound to a table using BindingSource and Linq to SQL classes. The table structure is like this:
MainTable
----------
ID Name FormReserveId
123 asd 15
FormReserves
-----------------
ID FormId Number
15 33 some number
Forms
------
ID FormName
33 form name
MainTable.FormReserveId foreign key to FormReserves.ID
Fo...
Hi there,
I am trying to create an extension method that i can forward a IList of statuses and check weather they exist, I thought the best way to do this was an ILIST - but maybe i wrong? Is this the best way to pass multple items to a method - A List? Its a generic LIST so hence no conversion etc from Object.
Basically I have this as...
I have been renaming our model names in our codebase using resharper. I had made some changes some of the modals names within the .dbml file. I noticed that I need to add the name attribute to the propery in order for the sql to work correctly. I add added this in the code behind view of the .dbml file. I switched back to the designer an...
I need to strip the following chars from my records using LINQ to SQL query
"\";:'.,=+!@#$%^&*(_)~{}[]\\|<>? aeiouAEIOU"
I can do it with my linq query here
from p in customers
select new {customer_name = String.Concat(p.First_name.Replace("A","@"),p.Last_name.Replace("A","@")), address = p.Address.Replace("A","@") }
but I know th...