Проблем със задачите от Entity Framework Introduction.
Здравейте,
При пускане на файла за решение на задача за C# DB Advanced, Judge ми дава следната грешка:
Compiled file is missing. Compiler output: MSBuild version 17.3.2+561848881 for .NET
А това е кодът и проектът:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>_02.DatabaseFirst</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="17.8.3" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.8.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>
</Project>
using System;
using System.Data.SqlClient;
namespace _02.DatabaseFirst;
public class Program
{
private const string connectionString = @"Server=localhost;Database=MinionsDB;User Id=sa;Password=Husabergfs650";
public static void Main(string[] args)
{
using SqlConnection sqlConnection = new SqlConnection(connectionString);
try
{
sqlConnection.Open();
using SqlCommand getViliansCommand = new SqlCommand(SqlQueries.VilliansWithMoreThan3Minions, sqlConnection);
using SqlDataReader sqlReader = getViliansCommand.ExecuteReader();
while (sqlReader.Read())
{
Console.WriteLine($"{sqlReader["Name"]} - {sqlReader["MinionsCount"]}");
}
}
finally
{
sqlConnection.Close();
}
}
}
namespace _02.DatabaseFirst;
public static class SqlQueries
{
public const string VilliansWithMoreThan3Minions = @"SELECT Name
,COUNT(*) AS MinionsCount
FROM Villains v
JOIN MinionsVillains mv ON v.Id = mv.VillainId
GROUP BY Name
HAVING COUNT(*) > 3
ORDER BY MinionsCount";
}
Ако някой е имал подобен проблем, моля да сподели, понеже не успях да разбера каква е причината?