Hi,
In our desktop application,we bind grids to data.Now,for example a grid is showing records of customers.The user can edit any record,and click save.Instead of save, he can click cancel too.I am able to get originalstate of all objects and show their values in the grid.But,I have not found a way to cancel\clear updates collection as ...
I've search control with which I'm trying to implement search as user types something. I'm using Linq to SQL to fire queries against the database. Though it works fine usually, when user types the queries really fast some random SqlException is thrown. These are the two different error message I stumbled across recently:
A severe err...
Byt lets say I have an integer weight where i.e. elements with weight 10 has 10 times higher probability to be selected than element with weight 1.
var ws = db.WorkTypes
.Where(e => e.HumanId != null && e.SeoPriority != 0)
.OrderBy(e => /*????*/ * e.SeoPriority)
.Select(e => new
{
DescriptionText = e.DescriptionText,
HumanId = e....
I have a table aspnet_User in my model(dbml file) where I have a property UserName which is ReadOnly. I thought I could do this.
var mockAsp_NetUser = new Mock<aspnet_User>();
mockAsp_NetUser.SetupGet(au => au.UserName).Returns("JohnDoe");
But then I get an exception: Invalid setup on a non-overridable member.
An easy solution would ...
Hi.
I have a LINQ query which returns a set of rows. The structure is:
NAME, col1, col2, col3, col4
name1 1 null null null
name1 null 1 null null
name1 null null 1 1
As a result I want to have one row containing
name1 1 1 1 1
So I want to group those results by name and merge (sum?) th...
Setup: ASP.net 3.5, Linq-to-Sql. Separate Web and DB servers (each 8-core, 8GB RAM). 4 databases. I am running an insert operation with a few million records into DB4 (using Linq-to-Sql for now, though I might switch to SqlBulkCopy). Logging shows that records are being put in consistently at a rate of 600-700 per second (I am running Da...
i'm having to two tables, which i need to compare both the table.
Let say table 1) Student profile 2) staff list.-- in this each staff has their student id , like many row
I need to get the current staff who log in's student id which may be many row.
And the resulted student profile from table 1.
...
It seems like LINQ to SQL has some support for eager loading. Let's say I wanted to load a blog post with all of its comments, for example:
var options = new DataLoadOptions();
options.LoadWith<Post>(p => p.Comments);
dataContext.LoadOptions = options;
This works fairly well, but it feels a little strange to be defining this on the da...
With my source in Subversion, I am having issues when 2 different computers have different connection strings.
The LINQ to SQL designer seems to only like having the same connection string.
Is it possible for the designer to use a connection string that varies since developers have different local configurations, but the actual usage i...
In my database designs, I tend to have "clusters" of tables. These clusters will typically support one application or group of tightly-functionally-related applications. Often, these clusters also relate to each other through a relatively small number of foreign keys; this helps otherwise independent applications in the business integrat...
I created one asp.net mvc application using linq to sql, and in the generated code it created this:
public ApowDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["APOWConnectionString"].ConnectionString, mappingSource)
{
OnCreated();
}
Which worked well, However in my next ...
My SQL tables names are all plural - Events, Teams, Campuses, etc...
When I drag the tables in to the dbml, it creates an entity called "Campuse" which of course is incorrect. I manually rename that to Campus in the properties page, but it doesnt seem to update all of the auto generated code correctly. For example, the .designer.cs fil...
Hi, I have created a function that retrieves values based on datepart of a datefield from a stored procedure:
public List<spDB1GetIDsByTimeResult> GetIDsByTime(int timePart)
{
using (DB1DataContext db1= new DB1DataContext ())
{
List<spDB1GetIDsByTimeResult> query = db1.spDBGetIDsByTime(timePart).ToList()...
how to generate a DBML file using the ConnectionString in ASP.NET MVC
...
I'm using Linq to SQL for the Database operations, and am trying to perform insert operations in a VIEW, It throws the Error,
XXt threw exception: System.InvalidOperationException: Can't perform Create, Update or Delete operations on 'Table(XXX)' because it has no primary key.
How to use LINQ to insert a record into View using C#?
Th...
Hello,
I'm trying to convert a standard SQL query to a LINQ to SQL query.
I was wondering what the LINQ equivalent of the T-SQL function STR() is?
STR (T-SQL)
Returns character data converted from
numeric data.
Syntax STR(float_expression[, length[,
decimal]])
Arguments float_expression Is an
expression of app...
Is it possible to do this in LINQ to SQL in a single command?
/* Hello, everyone */
Insert into Messages (
Message,
ContactID
)
Select
Message='Hello',
ContactID=ContactID
From Contacts
(I know I could iterate through Contacts, InsertOnSubmit many times, and SubmitChanges at the end; but this generates one Insert comman...
Hi all,
Here is the scene.....
I 2 separate contexts in LINQ, the actual database is one, and the contexts basicaly break concerns, and in this case, I using 3 tables.
Table 1 (AccountId) (Context 1)
Table 2 (PersonId) (Context 2)
Table 3 (AccountId, PersonId) (Context 2)
So what happens here is that (Context 2) can only create a re...
Hi all,
I'm getting the following error during code execution of a particular stored procedure and i'm stumped. Some other stored procedures work correctly but this one doesn't for some reason.
Warning: Fatal error 5242 occurred at Nov 25 2009 12:44PM. Note the error and time, and contact your system administrator
Line 66: public...
My database doesn't have any FK mapped in the tables, only PK indexes.
If I use linq2sql, what are the ramifications of this db design?
...