How to update field without loading entire entity?
Hi, is it possible to update only a single field/column without loading the entity? Normally i look up an entity through id and then update a field/property then use _context.Update() and save..Why do...
View Articlewhy are paramName and others needed if not used?
In this method, public static int UpdateEmployee(int EmployeeId, string Name, string Gender, string City) { string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; using...
View ArticleTransaction usage
Hi,I would like to implement a daily job in order to read from a database table if there are results, it will insert into two different tables and finally updates the record which is being read from...
View ArticleLinq changed variable name-prevents Insert
I have a table that has a foreign key category.idWhen I dragged the table onto the dbml diagram the field name has been changed to category_idI have also dragged an INSERT stored procedure onto the...
View ArticleCRUD in Jqgrid MVC using stored procedure: JSON data
Hi there:I intend to use ADO.NET via stored procedure to CRUD my Jqgrid in ASP.NET MVC. I know how fill jqgrid with a stored procedure but don't know how to do implement the Edit, Delete and Insert...
View Articledotnet ef CLI - Cannot find compatible framework version
Hi, I am using the .NET command line tool for Entity framework, keying indotnet ef dbcontext infoIt says cannot find compatible framework version. It is looking for Microsoft.NETCore.App version 3.1.1...
View ArticleEF Core -> Split one Model into two
Hello,I have an API that has one schema that references dbo. I need to make 2 different APIs that will be two new schemas now and remove all tables from dbo.I also need to remove about 5 tables/a...
View Articledoes record exist in table
Is there a way using LINQ to see if a record exist in a table, if not, do an insert from another table?Example:Table 1 looks like this:Sales table in production id salesid Location SalePrice...
View ArticleEF6.3+/.NET Core 3 web application, EDMX and classes as linked files
Background info: https://devblogs.microsoft.com/dotnet/announcing-entity-framework-6-3-preview-with-net-core-support/ Linked files scenario also mentioned here:...
View ArticleSqlDataReader not throwing an exception
I have method public static SqlDataReader ExecuteReader(SqlCommand cmd, int level = 0){SqlConnection conn = cmd.Connection;SqlDataReader dr = null;cmd.CommandTimeout = SqlConnectionTimeOut;DateTime...
View Articleplease help me add a column to a asp web app mysql; table
I am trying to type Enable-Migrations into my package manager console but this error shows upPM> Enable-Migrations System.ArgumentException: The parameter is incorrect. (Exception from HRESULT:...
View ArticleInvalid object error in EF
I want to get product and all its images. but i am getting invalid object error [HttpGet("prodimages")] public IActionResult ProductWithImages(int PID=2) { var productsWithImages =...
View Articlecontext.Entry(entity).State = EntityState.Modified; won't update my record.
I have another project that uses the same way like context.Entry(entity).State = EntityState.Modified; to update a record and it works but on this project is does not. How can I fix this? and why is it...
View ArticleThe Entity Framework provider ... could not be loaded
I created a very simple CodeFirst Console app using EF6, based on a CodeProject article (2015 IIRC). It worked perfectly. I modified it to use MySQL, and it throws an error at: public Context() :...
View ArticleLinq query not bringing latest record on two table
Dear All, The following query has not to return the latest records based on the record updated time. it brings the records wrongly. List<int> resp = new List<int>() { 2, 3}; var list =...
View Articleget all records created today when date is formatted as UTC
How can I get all the records that were created today when the createDate has UTC time stored in it?example:2020-01-30 13:00:30.33I just want the record if it was created today (1-30-2020) My where...
View ArticleMysterious Table name "People" VS2017
I created a simple console app that uses EF6 and MySql. Here is the connectionString in app.config:<add name="Track" connectionString="Server=MyServer; UID=Myuserid; Pwd=Mypassword; Database=Track;...
View ArticleEF Core 2.2 Left Outer Join with Group By Aggregation
Hi there,I have one entity, Property, with a value object Address, by using EF Core Code First, I got a table of Property and Address with a primary key point to the PropertyId. What I need to do is to...
View Articleget related data using Ef core 3.1 & view model
hello i trying to get related data from 3 db tables so i will get at the results a list of Quetta with a list of QuoteQuestion with a single answer .for each QuoteQuestion my models look like this :...
View Articleget related data using Ef core 3.1 & view model
hello i trying to get related data from 3 db tables so i will get at the results a list of Quetta with a list of QuoteQuestion with a single answer .for each QuoteQuestion my models look like this :...
View Article