Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Browsing all 1698 articles
Browse latest View live

Seeding users using UserManger and Identify role class thinks its a static class

I am trying to seed users and permissions but no matter what I do I get the following error.But when you look below at my code not one method is a static method so why on earth is visual studio...

View Article


Scaffold common base class for all entities

Creating ASP.NET 5 Core MVC application using Npgsql EF Core provider. Scaffold creates Poco classes like namespace MyDbContext { public partial class Customer { public Customer() { } public string Id...

View Article


Help with composing async Task .....

I must select distinct values from one column named YEAR from the database table.  I MUST use async Task<IEnumerable<variables>> for this code in my class library.I need help with the body...

View Article

Help retrieving columns from StoredProcedure using LINQ...

I need to retrieve data by using a stored Procedure using MVC LINQ.   I need to retrieve two fields from the table.My method is a public async Task IEnumerable and inside the body needs to return two...

View Article

Linq GroupBy and Sum - .First() could not be translated

My data is owner, location, date, charge, payment, the plan is to get a list of owners, each having a location, and the Sum OwnerTotal (charge - payamount)OwnerIdLocationChargePayAmount1Loc 110001Loc...

View Article


EF Core 5 - Does the order of Include()/Where() methods in queries matter?

I am upgrading from .NET Core 2.2 to .NET 5.0 one major release at a time (2.2 -> 3.0 -> 3.1 -> 5.0), and I have a LINQ query into a MySQL database that works differently after the upgrade to...

View Article

EF Core 5.0.X Model Customizations - database first

I am modernizing a 4.X aspnet app to Blazor  Server/Wasm.In the original app I was using EF 6.4.X and a whole bunch of model customizations. Been looking for how I can stil use these but all I find is...

View Article

Editing SQL database items and Model Binding attributes?

Problem: I want to update an SQL database record and not create a new database entry.The ASP.Net Core MVC application I am working on involves inventory tracking.  Data are stored in an MS SQL server...

View Article


Walking into an antipattern? Fetching data multiple FKs many layers deep ...

Using SQL and EF Core, I need to efficiently fetch data scattered across many tables.There are ~50 tables, with many tables having multiple FK relationships, and the layers of FK relationships run up...

View Article


LINQ and Entity Framework errors

I have two tables in SQL database:Challenger (ChallengerID, FirstName, LastName, Email) Rank (RankID, ChallengerID, Best, DateAcheieved) and using entity framework to access data. When I am trying to...

View Article

How to use Clause "IN"

Hi All,How can I passed array companies id into the .Where highlight orange query below:-var companies = companies.Where(c=>!c.Id.Equals(0)).Select(c => c.Id).Distinct().ToList();...

View Article

Is there a way to get a link query to return a row from a table?

So I am trying to access a database table that has a field that I need to match and if there is a match I need to select data out a field in  that table. I have tried and few things and I am coming up...

View Article

Sum and Case to linq

Need help to convert sql to linq in c#SELECT    SUM(CASE WHEN Evaluation.StatusId = 3 THEN 1 END)AS EvalutionOK,        SUM(CASE WHEN Evaluation.StatusId = 4 THEN 1 END) AS EvalutionTodo,...

View Article


executeScalar method is giving error

Hi All,public string execCount(string query)        {            string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;            using (SqlConnection con = new...

View Article

listbox does not show the data

   public DataTable getCourses()        {            string CS = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;            using (SqlConnection con = new SqlConnection(CS))...

View Article


Can't migrate Entity Framework

HiI run this command on package manager console :pm>add-migration FirstAppDemobut keeping get this image:The project first app demo failed to build.What should I do?please inform.regardsSaeed

View Article

Number of rows returned by a DataReader

Hi, Is there any way to know how many rows the data reader returns after executing a SQL statement? For now, I am doing the follwing:if datareader.hasrows then while datareader.read count += 1 end...

View Article


Files under Miles under Model.tt

All the Entity classes under my Model.tt file are not included in TFS.  I had the EDMX have an issue and had to restore it from TFS.  all the files underneath have a blue arrow next to them.Any...

View Article

How to find duplicate records merge in MS.SQL

Hi Friends, Please ref my script, based on the GroupID, find the duplicate rows then merge, when VillageID Null/Zero the record can be removed.SQL Table Script:Create Table #T_Location(BranchID Int,...

View Article

Visual Studio can't load MySql.Data.EntityFramework

I'm trying to synchronize an old .net application with Visual Studio 2019. However, I'm getting the error below when I try to open the ADO.NETSeverity Code Description Project File Line Suppression...

View Article
Browsing all 1698 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>