Here is what will work
Project file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.0" />
</ItemGroup>
Code
using System.Data;
using Microsoft.Data.SqlClient;
namespace AutomationApp;
internal class Program
{
static void Main(string[] args)
{
RunStoredProc();
}
private static void RunStoredProc()
{
using var conn = new SqlConnection() { ConnectionString = "TODO" };
using var cmd = new SqlCommand("SelectAllTrainers",conn)
{
CommandType = CommandType.StoredProcedure
};
conn.Open();
cmd.ExecuteNonQuery();
}
}