четверг, 10 января 2013 г.

C# + MS SQL Server

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Sulution.Framework.Core
{
    public class SQLServerConnector
    {        
        SqlConnection con;
        SqlCommand cmd = null;
        SqlDataReader reader = null;

        public SQLServerConnector()
        {
            con = new SqlConnection();
        }

        public void SetParams(  string server,
                                string user,
                                string pwd)
        {            con.ConnectionString = "User ID=" + user + ";" +
                        "password=" + pwd + ";server=" + server + ";" +
                        "connection timeout=30";
        }

        public bool Connect()
        {
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                
                return false;
            }

            return true;
        }

        public void Close()
        {
            con.Close();
        }

        public SqlDataReader ExecQuery(string text)
        {
            cmd = new SqlCommand(text, con);
            reader = cmd.ExecuteReader();

            return reader;
        }    
    }
}

Docker. Первые контейнеры

Источник:  php.dragomano.ru Структура каталогов: ~/develop/web/project/                  nginx/      - сервис web-сервера                php...