|
using System;
using System.Collections.Generic;
using System.Text;
using DbKeeperNet.Engine;
using System.Data.Common;
using System.Configuration;
using System.Data.SqlClient;
namespace DbKeeperNet.SimpleDemo
{
class Program
{
static void Main(string[] args)
{
// const string connString = "pgsql"; // PostgreSql connection over .NET Connector
// const string connString = "mysql"; // MySql connection over .NET Connector
// const string connString = "sqlite"; // SQLite connection over .NET Connector
const string connString = "default"; // MsSql connection
using (UpdateContext context = new UpdateContext())
{
context.LoadExtensions();
context.InitializeDatabaseService(connString);
Updater updater = new Updater(context);
updater.ExecuteXmlFromConfig();
}
ConnectionStringSettings connectString = ConfigurationManager.ConnectionStrings[connString];
using (DbConnection connection = DbProviderFactories.GetFactory(connectString.ProviderName).CreateConnection())
{
connection.ConnectionString = connectString.ConnectionString;
connection.Open();
DbCommand cmd = connection.CreateCommand();
cmd.CommandText = "select * from DbKeeperNet_SimpleDemo";
DbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
Console.WriteLine("{0}: {1}", reader[0], reader[1]);
}
Console.ReadKey();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm software developer since 1996. I started with assembler on Intel 8051 CPUs, during years I was interested in C, C++, Sybase PowerBuilder, PHP, Sybase Anywhere Database, MSSQL server and multiplatform development.
Currently I'm developing in C++ and C# (this is my favorit and I spent some time with MCPD achievement). I'm also interested in design patterns.