This commit is contained in:
EonaCat 2022-09-21 17:22:40 +02:00
parent 40150215f2
commit 6340a48019
2 changed files with 14 additions and 11 deletions

View File

@ -19,11 +19,11 @@ namespace EonaCat.Sql
private static async void TestsqlServer() private static async void TestsqlServer()
{ {
var customerId = "AROUT"; var customerId = 2;
var result = SqlHelper.ExecuteQuery( var result = SqlHelper.ExecuteQuery(
@"Server=localhost;Database=NorthWind;User Id=sa;Password=jeroen;TrustServerCertificate=Yes;", @"Server=EONACATLAPTOP\SQLEXPRESS;Database=AdventureWorks2019;User Id=sa;Password=jeroen;TrustServerCertificate=Yes;",
$"SELECT * FROM Customers WHERE CustomerID = @0 AND Country = @1" $"SELECT * FROM Person.Person WHERE BusinessEntityID = @0 AND rowguid = @1"
, true, customerId, "UK"); , true, customerId, "D8763459-8AA8-47CC-AFF7-C9079AF79033");
if (result.HasResult && result.HasRows) if (result.HasResult && result.HasRows)
{ {
@ -31,8 +31,8 @@ namespace EonaCat.Sql
Console.WriteLine(string.Empty); Console.WriteLine(string.Empty);
foreach (var record in result.DataSet) foreach (var record in result.DataSet)
{ {
Console.WriteLine(record.CustomerID); Console.WriteLine(record.FirstName);
Console.WriteLine(record.ContactTitle); Console.WriteLine(record.MiddleName);
} }
} }
else else

View File

@ -8,18 +8,21 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.1" /> <PackageReference Include="Microsoft.Data.SqlClient" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EonaCat.Sql"> <Reference Include="EonaCat.Helpers">
<HintPath>..\..\..\EonaCat.Sql\bin\Release\net6.0\EonaCat.Sql.dll</HintPath> <HintPath>..\..\..\EonaCat.Helpers\EonaCat.Helpers\bin\Debug\net6.0\EonaCat.Helpers.dll</HintPath>
</Reference> </Reference>
<Reference Include="EonaCatLogger"> <Reference Include="EonaCat.Logger">
<HintPath>..\..\..\EonaCatLogger\bin\Release\net6.0\EonaCatLogger.dll</HintPath> <HintPath>..\..\..\EonaCat.Logger\EonaCat.Logger\bin\Release\net6.0\EonaCat.Logger.dll</HintPath>
</Reference>
<Reference Include="EonaCat.Sql">
<HintPath>..\..\..\EonaCat.Sql\EonaCat.Sql\bin\Release\net6.0\EonaCat.Sql.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>