Dotnet Core, Working with Relational Database

Dotnet Core, Working with Relational Database

Microsoft’s System.Data package enables you to work at a low level with sql databases.

using System;
using Microsoft.Data.Sqlite;

namespace SqliteConsoleTest
{
  public class Program
  {
    public static void Main(string[] args)
    {
      using (var connection = new SqliteConnection(           
        "Data Source=:memory:"))                              
      {
        connection.Open();
        var command = new SqliteCommand(                      
          "SELECT 1;", connection);                           
        long result = (long)command.ExecuteScalar();          
        Console.WriteLine($"Command output: {result}");
      }                                                       
    }
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *