select rows in sql with latest date from 3 tables in each group
How to make select inner join from 3 tables
View ArticleQuestions about how to use Code First Migrations properly
Hello All. I have been working on getting code first migrations working for my asp webpage working for many weeks with lots of frustration. The main reason why i want to use migrations is to add a new...
View ArticleCan I specify the parent ID column to use for one-to-many relationship with...
Hi everyone, I am running into an issue using EF code-first migrations and lists of objects that share a same base class. Here is what I have:Post base class has Id and ParentPostId for tree data...
View ArticleMapping issue in EDMX, Model First Approach
I am facing issue while following the model first approach, I am following the youtube vide "https://www.youtube.com/watch?v=1xHInJgta_U",I am able to resolve it by updating the model by...
View ArticleCode first migration
Hi, I have a ASP.NET Web Application (.NET Framework) using MVC. I have created it following a tutorial changing code to suit my needs.I will be changing the model, adding things like phone number...
View ArticleSaving a record with foreign key only?
Hi guys! I've been trying to figure if I can save a record by foreign key only. Here is an example:I have 3 classes:public class Person { public Person() { Link = new HashSet<Link>(); } public...
View ArticleDatabase
I have a problem connecting my .NET application to my database. As a database I use mysql on a raspberry pi on the same network as my .NET application.U can see my code in the code section. string...
View ArticleDataSet ReadXml to skip autoid
I have an xml file like the below one, read the file using DataSet.ReadXML method, and returns dataset with tables with additional column Criteria_Id which is breaking the application. How can I...
View ArticleRead Data from Sql
Hi, I have written a stored procedure like this - Select*,TotalRows= COUNT(*) OVER()fromMyTablewhere....now, I get TotalRows in SSMS, so to access the TotalRows i have updated my Modal class with...
View ArticleCRUD operation for Resource.resx file
Hello Everyone,For my application, I am using MVC 5 along with the SQL server 2012.In my application, most of the pages are bounded text from Resource.resx file like below...
View Articleerror: 40 -Could not open a connection to SQL Server
HelloWhile there is no error in my code, when I try to migrate I see this error in package manager console:A network-related or instance-specific error occurred while establishing a connection to SQL...
View ArticleMVC and ADO.Net
Hi Friends,I am trying to do something I would think would be extremely easy. Maybe I have got so used to using the entity framework, but I just want to return data from a stored procedure that...
View ArticleEF Core - InvalidOperationException: No database provider has been configured...
Hi all! I have this message after my application is starting and fetching data from db.InvalidOperationException: No database provider has been configured for this DbContext. A provider can be...
View Articlewhat is the order of exeution in linq.
like in sqlserver we have following order of execution.SELECT ORDERFROMONJOINWHEREGROUP BYWITH CUBE or WITH ROLLUPHAVINGSELECTDISTINCTORDER BYTOPcan i get the same msdn page where they have written the...
View ArticleEF Core 3 design time migrations broken by...
Using IDesignTimeDbContextFactory to generate migrations at design time, running Package Manager Console commands add-migration, update-datebase, etc.Microsoft.EntityFrameworkCore.Design now being a...
View Articleshould we put order by in list of objects while returning form api or they...
public class pdate {public DateTime ProgressDate { get; set; }public prog decimal{get;set;]}List<pdate> listpdate = new List<pdate>(); SCurve scurveObj = null;DateTime dtFrom1 =...
View ArticleHow can I load a dynamic database by entity framework core?
The database will record the batch number/name/production date(accurate to minutes) of the food. After the user bought the food, he will visit the website via QRCODE on the package(every QRCODE on the...
View ArticleSqlDataReader is not returning any records
Hi Friends,I am using the sqldatareader in MVC to return records and populate a model for my view. For some reason my code does not execute the while loop. I was wondering if someone could help me with...
View ArticleInvalid cast from 'System.DateTime' to 'System.Nullable`1[[System.DateTime,...
Hi All,I getting above error: Invalid cast from 'System.DateTime' to 'System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxx]]public...
View Articlehow to return id for newly created table in same method?
Hi, i have a controller that creates a table using EF with automated value for id.var cust = new Cutomer { Name = "James", Description = "Believs in ghosts" } _context.Customer.Add(cust); await...
View Article