mardi 12 janvier 2016

Dump database in sql format

I am beginning to learn C# and a common third part .NET library System.Data.Sqlite

Here is a very simple code that I managed to write so far, based on online tutorials;

using System;
using System.Data.SQLite;

namespace SQLiteSamples
{
    class Program
    {

        static void Main(string[] args)
        {
            SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=dummy.db");
            m_dbConnection.Open();
            string sql = "select * from my_table";
            SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
            SQLiteDataReader reader = command.ExecuteReader();
            while (reader.Read())
                Console.WriteLine(reader["my_col"]);
            Console.ReadLine();
        }
    }
}

I am looking for a way to dump all database into an sql dump using utf8 encoding. Is this possbile using this library?

Aucun commentaire:

Enregistrer un commentaire