/// <summary> /// 初始化成员变量等 /// </summary> private void Init() { m_sIp = ""; m_sName = ""; m_sUser = ""; m_sPass = ""; m_oMysql = new CMySql(); }
private List <CStudentInfo> m_lstStuInfo; //用来显示从数据库中查询的信息 /// <summary> /// 构造函数 /// </summary> /// <param name="_sMysql">操作mysql的对象</param> public fmStudent(CMySql _sMysql) { if (_sMysql != null) { m_oMysql = _sMysql; } m_oMysql = _sMysql; InitializeComponent(); //显示学生信息 ShowStudentInfo(); }
public CApplication() { if (!Directory.Exists("logs/")) { Directory.CreateDirectory("logs/"); CConsole.WARN("Directory 'logs/' was missing!"); } CConsole.PRINT("Console initialized..."); CConsole.PRINT("-----------------------------------------"); CConsole.GOOD(Settings.ApplicationName); CConsole.GOOD("Created By " + Settings.Developer + " - " + Settings.Version + " " + Settings.Date); CConsole.PRINT("-----------------------------------------"); if (!Directory.Exists("mods")) { CConsole.ERROR("No 'mods/' directory found. What now?"); } CPluginHost = new CPluginHosting("mods"); CConfig mainCFG = new CConfig("settings.cfg"); CMySql sql = new CMySql( mainCFG.GetCvar("sql_host").String(), mainCFG.GetCvar("sql_user").String(), mainCFG.GetCvar("sql_pass").String(), mainCFG.GetCvar("sql_port").String() ); Query query = sql.Query("SELECT * FROM accounts"); Row row = new Row(); while (query.Fetch(row)) { CConsole.DEBUG("USERNAME: "******"username")); } }
private void Set맨홀별구조물() { try { CMySql mysql = new CMySql(); mysql.Connect(); using (MySqlCommand mycommand = mysql.Connection.CreateCommand()) { MySqlTransaction mytrans; mytrans = mysql.Connection.BeginTransaction(); mycommand.Connection = mysql.Connection; mycommand.Transaction = mytrans; try { //DELETE COD10T00 CustomSqlQuery query = sqlData.Queries["관로별구조_DELETE"] as CustomSqlQuery; mycommand.CommandText = query.Sql; mycommand.Parameters.Clear(); ///기본 프로젝트는 'XXXXXXXXXX' 이다 mycommand.Parameters.AddWithValue("@P_PROJECT_CD", "XXXXXXXXXX"); mycommand.Parameters.AddWithValue("@P_P_MNGR_CD", "PIPE_ROAD"); mycommand.Parameters.AddWithValue("@P_P_CD", label포장.Text); mycommand.ExecuteNonQuery(); //INSERT COD10T00 //지운 후 신규작성해 불자 DataTable dt = (DataTable)gridControl2.DataSource; foreach (DataRow item in dt.Rows) { query = sqlData.Queries["관로별구조_INSERT"] as CustomSqlQuery; mycommand.CommandText = query.Sql; mycommand.Parameters.Clear(); ///기본 프로젝트는 'XXXXXXXXXX' 이다 mycommand.Parameters.AddWithValue("@P_PROJECT_CD", "XXXXXXXXXX"); mycommand.Parameters.AddWithValue("@P_P_MNGR_CD", item["p_mngr_cd"]); mycommand.Parameters.AddWithValue("@P_P_CD", item["p_cd"]); mycommand.Parameters.AddWithValue("@P_MNGR_CD", item["mngr_cd"]); mycommand.Parameters.AddWithValue("@P_CD", item["cd"]); mycommand.Parameters.AddWithValue("@P_ORD_SEQ", item["ord_seq"]); mycommand.Parameters.AddWithValue("@P_CD_VAL", item["cd_val"]); mycommand.ExecuteNonQuery(); } //dr["p_mngr_cd"] = "PAVE_CD"; //dr["p_cd"] = label포장.Text; //dr["p_cd_nm"] = labelControl1.Text; //dr["mngr_cd"] = 포장Row["mngr_cd"]; //dr["cd"] = 포장Row["cd"]; //dr["cd_nm"] = 포장Row["cd_nm"]; //dr["ord_seq"] = nCnt; MsgCaption.Caption = "정상 처리되었습니다."; mytrans.Commit(); } catch (Exception ex) { mytrans.Rollback(); MsgCaption.Caption = ex.Message; throw ex; } finally { mysql.Connection.Close(); } } } catch (Exception ex) { throw ex; } }