本文整理汇总了C#中DBManager.CreateConnection方法的典型用法代码示例。如果您正苦于以下问题:C# DBManager.CreateConnection方法的具体用法?C# DBManager.CreateConnection怎么用?C# DBManager.CreateConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager.CreateConnection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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;
}