/// <summary> /// SQLServerへの接続 /// </summary> /// <param name="connection">接続情報構造体</param> /// <param name="isMsgShow">メッセージ表示フラグ</param> /// <param name="isErrSkip">エラースキップフラグ</param> /// <param name="isRetryFlag">リトライフラグ</param> /// <param name="maxRetryTimes">最大試行回数</param> /// <returns>成功/失敗</returns> public bool ConnectToSQLServer(PgConnection connection, bool isMsgShow = false, bool isErrSkip = false, bool isRetryFlag = false, int maxRetryTimes = 0) { for (int retryTimes = 0; retryTimes <= maxRetryTimes; retryTimes++) { try { if (connection == null) { return(false); } DBinfo.sqlConnection = new NpgsqlConnection(); DBinfo.sqlConnection.ConnectionString = connection.Server.ToString(); DBinfo.sqlConnection.Open(); // 各パラメータのセット DBinfo.transFlag = false; DBinfo.conFlg = true; return(true); } catch (SqlException ex) { DBinfo.conFlg = false; HandleError(ex, isMsgShow, isErrSkip, isRetryFlag, maxRetryTimes, retryTimes); if (!isRetryFlag) { return(false); } } }
public PgSqlManager() { connection = new PgConnection(); sqlConnecter = new PgSqlConnecter(new PgDBProvider()); }