Ejemplo n.º 1
0
 public void Close()
 {
     if (mIDbconn == null)
     {
         return;
     }
     mIDbconn.Close();
     mIDbconn = null;
 }
Ejemplo n.º 2
0
        public int Connect()
        {
            if (string.IsNullOrEmpty(strConnString))
            {
                return(-1);
            }
            // default
            int ret = -1;

            try
            {
                switch (mDbType)
                {
                case DbType.Memory:
                {
                    if (mIDbconn == null)
                    {
                        mIDbconn = DBConnMemory.Instance;
                    }
                    ret = mIDbconn.Connect(strConnString);
                }
                break;

                case DbType.SQLite:
                {
                    if (mIDbconn == null)
                    {
                        mIDbconn = new DbConnSqlite();
                    }
                    ret = mIDbconn.Connect(strConnString);
                }
                break;

                case DbType.Mysql:
                {
                    if (mIDbconn == null)
                    {
                        mIDbconn = new DbConnMysql();
                    }
                    ret = mIDbconn.Connect(strConnString);
                }
                break;

                default:
                    throw new Exception("DbType not support");
                    //break;
                }
            }
            catch (Exception exp)
            {
                MyLog.Log("EXP:" + exp.Message);
                //throw;
            }

            return(ret);
        }