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

namespace ajans.class_ajans
{
   public class database
    {
        OleDbConnection con = new OleDbConnection();
        public void connect()
        {
            con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\ajansdb.accdb";
            if (con.State == ConnectionState.Closed) con.Open();
        }
        public void disconnect()
        {
            if (con.State == ConnectionState.Open) con.Close();
        }
        public DataTable docommand(OleDbCommand com)
        {
            DataTable dt = new DataTable();
            OleDbDataAdapter da = new OleDbDataAdapter(com);
            com.Connection = con;
            com.CommandType = CommandType.Text;
            da.Fill(dt);
            return dt;
        }
        public void command(OleDbCommand com)
        {
            com.Connection = con;
            com.CommandType = CommandType.Text;
            com.ExecuteNonQuery();
        }
    }
}
