Cascade delete entitiyframework core
I'm a bit confused about this. So By convention, Entity Framework enables cascade delete for non-nullable foreign keys and for many-to-many relationships. if I have a foreign key on one table called...
View ArticleGetting SUM of column and group
Hi all. I have 2 tables (tblGenerator AND tblGeneratorLine). tblGenerator contains ingormation about each generator, and the tblGeneratorLine contains the rent per month per generator. I want to get a...
View ArticleADO.NET entity data model - problem with foreign keys
Im using the ADO.NET entity data model wizard to create a bunch of POCO's from my database. I choose the code first from database option, then select the tables i require. The 'include foreign key...
View ArticleEF error when returning from Stored Procedure in EF 6.1.2
When I am calling a stored procedure I am seeing this error:Additional information: The data reader is incompatible with the specified '.sp_MySp_Result'. A member of the type, 'Column1', does not have...
View ArticleEfficient way to be update grand child records in c# using LINQ
I have to update a column 'PPMOProjectID' in the table, but in such way that if it is empty and tricky part is I have a scope of only parent child relation ship in the table like if MP- master parent,...
View ArticleDatabase objects are not in my Entity
Hi All,I started using Entity framework with web forms. For that I have created an entity. My entity's name is MIS.Below is my .edmx diagrame.The problem is neither I am able to access my namespace nor...
View ArticleError-There is already an open DataReader associated with this Command which...
Hi Below is the codefunction FillCity() { var stateId = $('#StateId').val();$.ajax({ url: '/Customer/GetCity', type: "GET", dataType: "JSON", data: { StateId: stateId }, success: function (cities)...
View ArticleEntity Framework in one project but on 2 solutions
HiI have an entity framework project in my solution which is a CMS, and I also have a solution which uses the same project, using Add Exisiting Project.Everything works fine on the CMS project, but...
View ArticleSQL Query to LINQ
Hi guys,Please assist in converting the sql query below to Linq query. Many thanks.select SalesRep.FirstName, Business.BusinessName, [Month].[MonthName], [Year].YearName from TargetHead inner join...
View ArticleConvert or map/add Entity Framework Stored Procedure Result Set records to...
Hi there,I have stored procedure which I have imported in EF and its returning n number of records and its return type is ObjectResult<spGetProductData_Result1> this result set I am storing in...
View ArticleCompare 2 entity items
Not sure how to subscribe this, but I need to compare 2 items in a where clause, but 1 that comes from another joinI placed a comment after the where clause and after the join that the data item come...
View Articlecustomize a sql command in foxpro c#
/* Microsoft SQL Server Integration Services Script Task Write scripts using Microsoft Visual C# 2008. The ScriptMain is the entry point class of the script. */using System; using System.Data; using...
View ArticleEntity Framework:- Violation of PRIMARY KEY constraint . Cannot insert...
HelloI am inserting new data in a few different tables with the same data from my main table, but after inserting say 4 or 5 records I get the above error for one of the tables, here is my codepublic...
View ArticleNot Sure On Approach to Take
I have a modelpublic class ClientContact { public int ClientContactID { get; set; } [Display(Name ="Client")] public int ClientID { get; set; } [Display(Name = "Contact Name")] public string...
View ArticleHow can I hide certain fields when accessing database from DbContext
In my database I have relations, for example, I have a table like:CarId, Model, Manufacturer, Owner where Owner is a foreign key to another table. I have a DbSet<Car>How can I select all columns...
View Articlematerialising hierarchical data into custom dto's
I have 3 tables in a master detail relationship and I want to materialise data into a set of custom dtos' but I cant get it to work, heres my linq statementvar overView = await (from organisation in...
View Articleretrieving data from multiple nested table levels
I have a master table with a detail table linked by a foreign key (integer), this detail table then has its own child table again linked by a foreign key (integer). So I have 3 levelsIn my LINQ quey I...
View ArticleEntityFramework unable to insert data into SQLServer table
Hi, As above,error Msg :System.Data.SqlClient.SqlException: Cannot insert explicit value for identity column in table 'Customers' when IDENTITY_INSERT is set to OFF. in SQL Server table, I have...
View ArticleLoad data from one form to another on a grid
good afternoonLords programmersIf someone can guide me please I am making a sale application for warehouse, with rod bar works that part when pistolear load the products on the grid okSearch code...
View ArticleHow to group Northwind orders based on Customer ContactName
Im using northwind database . U may see the attached files .My view displays all orders from the database without an order . I want to display orders based on contactname (customer) and alphabetically...
View Article