I get this error
Cannot add an entity with a key that is already in use
when I try to save an Item
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Item item)
{
Global.DataContext.Items.Attach(item);
Global.DataContext.SubmitChanges();
return View(item);
}
That's because I cannot attach the item to the global DataCo...
I've got a vertical market Dot Net Framework 1.1 C#/WinForms/SQL Server 2000 application. Currently it uses ADO.Net and Microsoft's SQLHelper for CRUD operations.
I've successfully converted it to Dot Net Framework 4 C#/WinForms/ SQL Server 2008. What I'd like to do is also offer my customers the OPTION to use SQL Azure as a backen...
I have a fairly simple form:
<asp:FormView>
<EditItemTemplate>
<asp:LoginView>
<RoleGroups>
<asp:RoleGroup roles="Blah">
<ContentTemplate>
<!-- Databound Controls using Bind/Eval -->
</ContentTemplate>
</asp:RoleGroup>...
what is the order of this function's execution:
var queryResult = names.OrderBy(item => item).Where(it => it.StartsWith("S"))
...
I am using ASP.NET DynamicData (based on LINQ to SQL) on my site for basic scaffolding. On one table I have added additional properties, that are not stored in the table, but are retrieved from somewhere else. (Profile information for a user account, in this case).
They are displayed just fine, but when editing these values and pressing...
I have a L2S Repository class which instantiates the L2S DataContext in its constructor.
The repository is instantiated at run time (using Unity) in a service hosted in IIS with WCF.
When I run up the client MVC applicaton the calls to the backend WCF service work for a while and then timeout.
I suspected perhaps a database issue as I...
I need to get the list of records that does not starts with alphabets. i.e. Which starts with numeric and any special character.
I am using asp.net mvc (C#) for my application.
Whats the simple linq query to get this list?
...
Hi,
I have an SQL database, which is a "feeder" table. I put records in said table, a 3rd party package consumes (and deletes) them. All hunky dory - until the 3rd party package isn't running. In thinking about how to detect that, I thought to myself... "well... what if I read all the keys in the table (its not very big - max a few doze...
What pattern should I use for data-access in case of VS2008 generated L2s or EF DataModels? Repository-pattern or what?
As we know VS2008 generates Data-Models and DataContexts/ObjectContexts in the same file, then, how should I arrange my VS2008 assemblies in my VS2008 solution to achieve a layered design?
If I use repository pattern,...
I've written the following Linq query:
IQueryable<ISOCountry> entries =
(from e in competitorRepository.Competitors
join c in countries on e.countryID equals c.isoCountryCode
where !e.Deleted
orderby c.isoCountryCode
select new ISOCountry() { isoCountryCode = e.countryID, Name = c.Name }
).Distinct();
The objective is...
I read other posts on similar problem on using SingleOfDefault on Linq-To-Entity, some suggested using "First()" and some others suggested using "Extension" method to implement the Single().
This code throws exception:
Movie movie = (from a in movies
where a.MovieID == '12345'
select a).SingleOrDefaul...
I need to convert the below Sproc to a Linq query. At the very bottom is what I have so far. For reference the fields behind the "splat"(not my sproc) are
ImmunizationID int, HAReviewID int, ImmunizationMaintID int, ImmunizationOther varchar(50), ImmunizationDate smalldatetime, ImmunizationReasonID int
The first two are PK and FK, r...
Not sure if I am using the correct term, but it's not child/parent since they aren't nested objects. In my application I've got a User, UserUserGroup, and UserGroup objects which are pretty standard, UserUserGroup is a linking object with corresponding IDs. I am using Linq-to-SQL so unforunately it doesn't used nested objects, but it sti...
Context: ASP.NET MVC 2.0, C#, SQL Server 2007, IIS7
I have 'scheduledMeetings' table in the database.
There is a one-to-many relationship: scheduledMeeting -> meetingRegistration
So that you could have 10 people registered for a meeting.
meetingRegistration has fields Name, and Gender (for example).
I have a "calendar view" on my sit...
Hello,
I'm searching info about configuring own MetaData in asp.NET Dynamic Site.
For example. I have a table in MS Sql Server with structure shown below:
CREATE TABLE [dbo].[someTable](
[id] [int] NOT NULL,
[pname] [nvarchar](20) NULL,
[FullName] [nvarchar](50) NULL,
[age] [int] NULL)
and I there are 2 Ms Sql table...
I have a groupby that I groups all elements. I can see the items are there in LinqPad but can't find a way to get the count.
Here is what I have so far:
SurveyResponses.Where( q => q.QuestionId == 4).GroupBy(q => q.AnswerNumeric).Where( g => g.Key == 1)
In Linq Pad I can see there are 4 items in this query. If I do Count it returns 1....
Hi
I am new in SSRS reporting service..
So please guide me how can i develope report ?
also tell me which tool required and what are the pre-requists ?
i want to develope report using linq datasource and to use it in my wpf application..
please guide me... i need help..
...
I have 2 databases - (1) Feeds, (2) Production. The feeds database is fed from client files that we get on a daily basis and is, from my viewpoint, a read only source of data. When a feed file is received the feed app does its thing then finally calls a web service on the production site. This web service then does a sync between the ...
Is there any way showing the detailed exception for String or binary data would be truncated.
I use LINQ to SQL and i cant figure out which column is that!?
Tried numerous things but i get the same meaningless error i got from within Visual Studio.
Also I use .NET 3.5 SP1, but errors are still returned useless.
...
I am building an application that requires separate SQL Server databases for each customer.
To achieve this, I need to be able to create a new customer folder, put a copy of a prototype database in the folder, change the name of the database, and attach it as a new "database instance" to SQL Server. The prototype database contains all...