本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例6: Save
public void Save()
{
DBManager db = new DBManager();
db.Connect();
db.Insert(String.Format("insert into size VALUES (null,'{0}')", sizeLabel));
db.Close();
}
示例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();
}
示例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]);
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}