creation de connexion pour azure ... En attente
continuous-integration/drone/push Build is passing Details

connexion
Nicolas MAYE 2 years ago
parent 57ddecbe9e
commit c48b6e2438

@ -14,6 +14,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestsUnitaires", "TestsUnit
{ACFA83F8-98C8-43AE-9328-B3F751098FFA} = {ACFA83F8-98C8-43AE-9328-B3F751098FFA}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToSql", "LinqToSql\LinqToSql.csproj", "{1F51162A-1232-42E1-A2C3-B19D96905696}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -36,6 +38,10 @@ Global
{B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Release|Any CPU.Build.0 = Release|Any CPU
{1F51162A-1232-42E1-A2C3-B19D96905696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F51162A-1232-42E1-A2C3-B19D96905696}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F51162A-1232-42E1-A2C3-B19D96905696}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F51162A-1232-42E1-A2C3-B19D96905696}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -0,0 +1,14 @@
<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.0.1" />
</ItemGroup>
</Project>

@ -0,0 +1,46 @@
using System;
using Microsoft.Data.SqlClient;
using System.Text;
namespace sqltest
{
class Program
{
static void Main(string[] args)
{
try
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = "<your_server>.database.windows.net";
builder.UserID = "<your_username>";
builder.Password = "<your_password>";
builder.InitialCatalog = "<your_database>";
using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
{
Console.WriteLine("\nQuery data example:");
Console.WriteLine("=========================================\n");
String sql = "SELECT name, collation_name FROM sys.databases";
using (SqlCommand command = new SqlCommand(sql, connection))
{
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine("{0} {1}", reader.GetString(0), reader.GetString(1));
}
}
}
}
}
catch (SqlException e)
{
Console.WriteLine(e.ToString());
}
Console.ReadLine();
}
}
}
Loading…
Cancel
Save