当前位置: 首页>>代码示例>>C#>>正文


C# DBManager.Close方法代码示例

本文整理汇总了C#中DBManager.Close方法的典型用法代码示例。如果您正苦于以下问题:C# DBManager.Close方法的具体用法?C# DBManager.Close怎么用?C# DBManager.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBManager的用法示例。


在下文中一共展示了DBManager.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectFromDB

        public static DataRowCollection SelectFromDB(String query, String database)
        {
            DBManager dbManager = new DBManager();
            MySqlConnection con = null;

            try
            {
                String ip = DBConst.kDbIp;
                con = dbManager.CreateConnection(ip, database);
                con.Open();

                MySqlCommand cmd = new MySqlCommand(query, con);
                MySqlDataAdapter dataAdapter = new MySqlDataAdapter(cmd);

                DataSet ds = new DataSet("data");

                dataAdapter.Fill(ds, "data");
                DataRowCollection drc = ds.Tables["data"].Rows;

                return drc;
            }
            catch (System.Exception ex)
            {
                logger.Warn(ex.ToString());
            }
            finally
            {
                dbManager.Close(con);
            }
            return null;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:31,代码来源:DBUtil.cs

示例2: Save

 public void Save()
 {
     DBManager db = new DBManager();
     db.Connect();
     db.Insert(String.Format("insert into size_map VALUES (null,'{0}','{1}')", productID, sizeID));
     db.Close();
 }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:7,代码来源:SizeMapDAO.cs

示例3: Execute

        public static int Execute(String query, String database)
        {
            DBManager dbManager = new DBManager();
            MySqlConnection con = null;

            try
            {
                String ip = DBConst.kDbIp;
                con = dbManager.CreateConnection(ip, database);
                con.Open();

                MySqlCommand cmd = new MySqlCommand(query, con);

                int ret = cmd.ExecuteNonQuery();
                return ret;
            }
            catch (System.Exception ex)
            {
                logger.Warn(ex.ToString());
            }
            finally
            {
                dbManager.Close(con);
            }
            return -1;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:26,代码来源:DBUtil.cs

示例4: Save

 public void Save()
 {
     DBManager db = new DBManager();
     db.Connect();
     db.Insert(String.Format("insert into product VALUES (null,'{0}','{1}','{2}','{3}')", name, collectionID, price, description));
     db.Close();
 }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:7,代码来源:ProductDAO.cs

示例5: Save

 public void Save()
 {
     DBManager db = new DBManager();
     db.Connect();
     db.Insert(String.Format("insert into product_image VALUES (null,'{0}','{1}','{2}')", productID, url, orderOfDisplay));
     db.Close();
 }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:7,代码来源:ProductImageDAO.cs

示例6: Save

 public void Save()
 {
     DBManager db = new DBManager();
     db.Connect();
     db.Insert(String.Format("insert into size VALUES (null,'{0}')", sizeLabel));
     db.Close();
 }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:7,代码来源:SizeDAO.cs

示例7: Save

 public void Save()
 {
     DBManager db = new DBManager();
     db.Connect();
     db.Insert(String.Format("insert into product_detail VALUES (null,'{0}')", description));
     db.Close();
 }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:7,代码来源:ProductDetailDAO.cs

示例8: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Application[Constants.FRONT_PAGE_IMG_API_CACHE] == null)
        {
            DBManager db = new DBManager();
            db.Connect();
            List<FrontImageDAO> imgList = db.GetAllFrontPageImages();
            db.Close();

            var serializer = new JavaScriptSerializer();
            var serializedResult = serializer.Serialize(imgList);
            Application[Constants.FRONT_PAGE_IMG_API_CACHE] = serializedResult;
        }
        Response.Write(Application[Constants.FRONT_PAGE_IMG_API_CACHE]);
    }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:15,代码来源:FrontPageImageAPI.aspx.cs

示例9: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        DBManager db = new DBManager();
        db.Connect();
        List<FrontImageDAO> storedImagesList = db.GetAllFrontPageImages();
        db.Close();

        foreach(FrontImageDAO img in storedImagesList)
        {
            Panel_UploadedImage ui = (Panel_UploadedImage)LoadControl("~/Panel/UploadedImage.ascx");
            ui.fileName = img.fileName;
            ui.path = img.path;
            ui.link = img.link;
            pictureList.Controls.Add(ui);
        }
    }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:16,代码来源:FrontPageImages.aspx.cs

示例10: deleteButton_Click

    protected void deleteButton_Click(object sender, EventArgs e)
    {
        try
        {
            DBManager db = new DBManager();
            db.Connect();
            db.DeleteFrontPageImage(fileName);
            db.Close();

            File.Delete(Server.MapPath("~/" + path + "/" + fileName));
            Application[Constants.FRONT_PAGE_IMG_API_CACHE] = null;
            Response.Redirect(Request.RawUrl);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
开发者ID:Ailanz,项目名称:ControlPanel,代码行数:18,代码来源:UploadedImage.ascx.cs

示例11: Listar

        public static List<Compra> Listar(Compra compraInicio, Compra compraFim, Produto produtoFiltro)
        {
            ValidarFiltro(compraInicio, compraFim, produtoFiltro);

            DBManager dbManager = new DBManager();
            dbManager.Open();

            StringBuilder stbSelect = new StringBuilder(SQL_SELECT);

            if (compraInicio != null)
            {
                if (!string.IsNullOrEmpty(compraInicio.Processo))
                {
                    stbSelect.AppendFormat(" and c.Processo = '{0}'", compraInicio.Processo);
                }

                if (compraInicio.Data.HasValue)
                {
                    stbSelect.AppendFormat(" and c.Data >= #{0} 00:00:00#", compraInicio.Data.Value.ToString("yyyy-MM-dd"));
                }
            }
            if (compraFim != null)
            {
                if (compraFim.Data.HasValue)
                {
                    stbSelect.AppendFormat(" and  c.Data <= #{0} 23:59:59#", compraFim.Data.Value.ToString("yyyy-MM-dd"));
                }
            }

            if (produtoFiltro != null)
            {
                if (!string.IsNullOrEmpty(produtoFiltro.CodigoEntrada))
                {
                    stbSelect.AppendFormat(" and p.CodigoEntrada = '{0}'", produtoFiltro.CodigoEntrada);
                }

                if (!string.IsNullOrEmpty(produtoFiltro.CodigoSaida))
                {
                    stbSelect.AppendFormat(" and p.CodigoSaida = '{0}'", produtoFiltro.CodigoSaida);
                }
            }

            IDataReader dr = dbManager.SelectData(stbSelect.ToString());
            List<Compra> compras = dbManager.CarregarLista<Compra>(dr, ConvertCompra);

            dbManager.Close();
            return compras;
        }
开发者ID:rcarubbi,项目名称:MVR.CadCompra,代码行数:48,代码来源:Compra.cs

示例12: LoadProduct

        void LoadProduct()
        {
            // 상품을 읽어온다.
            DBManager dbManager = new DBManager();
            MySqlConnection con = null;

            try
            {
                String ip = CommonConfig.DB_SERVER_IP;
                con = dbManager.CreateConnection(ip, CommonConfig.DATABASE_CORREL);
                con.Open();

                LoadProduct_Raw(con);
                logger.Info("데이터베이스에서 상품 정보를 모두 정상적으로 읽어왔습니다.");
            }
            catch (System.Exception e)
            {
                Error(e.ToString());
            }
            finally
            {
                dbManager.Close(con);
            }
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:24,代码来源:Form1.cs

示例13: GetLastDataDateFromDB

        String GetLastDataDateFromDB(String ticker)
        {
            // 상품을 읽어온다.
            DBManager dbManager = new DBManager();
            MySqlConnection con = null;

            try
            {
                String ip = CommonConfig.DB_SERVER_IP;
                con = dbManager.CreateConnection(ip, CommonConfig.DATABASE_CORREL);
                con.Open();

                return GetLastDataDateFromDB_Raw(con, ticker);
            }
            catch (System.Exception e)
            {
                Error(e.ToString());
            }
            finally
            {
                dbManager.Close(con);
            }
            const String kStartDate = "1990-01-01";
            return kStartDate;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:25,代码来源:Form1.cs

示例14: DBOutBloombergData

        Boolean DBOutBloombergData(String strTicker)
        {
            // 데이터 베이스에 블름버그 데이터를 삽입한다.
            // 상품을 읽어온다.
            DBManager dbManager = new DBManager();
            MySqlConnection con = null;

            try
            {
                String ip = CommonConfig.DB_SERVER_IP;
                con = dbManager.CreateConnection(ip, CommonConfig.DATABASE_CORREL);
                con.Open();

                return DBOutBloombergData_Raw(con, strTicker);
                //logger.Info(
                //    String.Format(
                //    "데이터를 정상적으로 데이터베이스에 입력하였습니다."));
            }
            catch (System.Exception e)
            {
                Error(e.ToString());
            }
            finally
            {
                dbManager.Close(con);
            }
            return false;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:28,代码来源:Form1.cs

示例15: Listar

        public static List<Produto> Listar(Produto filtro)
        {


            DBManager dbManager = new DBManager();
            dbManager.Open();

            StringBuilder stbSelect = new StringBuilder(SQL_SELECT);


            if (filtro.Codigo > 0)
            {
                stbSelect.AppendFormat(" and Codigo = {0}", filtro.Codigo);
            }

            if (!string.IsNullOrEmpty(filtro.Descricao))
            {
                stbSelect.AppendFormat(" and Descricao like '%{0}%'", filtro.Descricao);
            }

            if (filtro.Ativo.HasValue)
            {
                stbSelect.AppendFormat(" and Ativo = {0}", filtro.Ativo.Value ? "True" : "False");
            }

            if (!string.IsNullOrEmpty(filtro.CodigoEntrada))
            {
                stbSelect.AppendFormat(" and CodigoEntrada = '{0}'", filtro.CodigoEntrada);
            }

            if (!string.IsNullOrEmpty(filtro.CodigoSaida))
            {
                stbSelect.AppendFormat(" and CodigoSaida = '{0}'", filtro.CodigoSaida);
            }


            IDataReader dr = dbManager.SelectData(stbSelect.ToString());
            List<Produto> produtos = dbManager.CarregarLista<Produto>(dr, ConvertProduto);

            dbManager.Close();
            return produtos;

        }
开发者ID:rcarubbi,项目名称:MVR.CadCompra,代码行数:43,代码来源:Produto.cs


注:本文中的DBManager.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。