예제 #1
0
        public bool ExecuteQuery(string strSql)
        {
            bool flag = false;

            try
            {
                conn.BeginTrans();

                ADODB.Command cmd = new ADODB.Command();
                cmd.ActiveConnection = conn;
                cmd.CommandTimeout   = 90;
                cmd.CommandType      = ADODB.CommandTypeEnum.adCmdText;
                cmd.CommandText      = strSql;

                object objRecordsAffected = Type.Missing;
                object objParams          = Type.Missing;
                cmd.Execute(out objRecordsAffected, ref objParams, (int)ADODB.ExecuteOptionEnum.adExecuteNoRecords);

                conn.CommitTrans();

                flag = true;
            }
            catch (Exception ex)
            {
                flag = false;

                conn.RollbackTrans();

                //PublicLib.handleError("", this.GetType().Name, ex.Message + string.Format("({0})", strSql));
            }

            return(flag);
        }
예제 #2
0
파일: CGD2060C.cs 프로젝트: dmgfhc/NGHB
        public static bool Gf_ExecSql(ADODB.Connection Conn, string sQuery)
        {
            bool returnValue = false;

            //Dim iCount As Integer
            object[,] OutParam = new object[3, 5];

            ADODB.Command adoCmd;

            try
            {
                //Db Connection Check
                if (GeneralCommon.M_CN1.State == 0)
                {
                    if (GeneralCommon.GF_DbConnect() == false)
                    {
                        return(returnValue);
                    }
                }

                Cursor.Current = Cursors.WaitCursor;

                //Ado Setting
                GeneralCommon.M_CN1.CursorLocation = ADODB.CursorLocationEnum.adUseServer;
                adoCmd = new ADODB.Command();

                Conn.BeginTrans();

                adoCmd.ActiveConnection = GeneralCommon.M_CN1;
                adoCmd.CommandText      = "UPDATE  GP_USTRESULT SET  UST_LOC= '',UST_REMARTS   = '' WHERE  PLATE_NO  = '05201206040102'";

                object null_object  = "";
                object null_object2 = "";
                adoCmd.Execute(out null_object, ref null_object2, -1);
                Conn.CommitTrans();
                adoCmd         = null;
                Cursor.Current = Cursors.Default;

                if (GeneralCommon.M_CN1.State != 0)
                {
                    GeneralCommon.M_CN1.Close();
                }
            }
            catch (Exception ex)
            {
                adoCmd = null;
                Conn.RollbackTrans();
                returnValue    = false;
                Cursor.Current = Cursors.Default;
                if (GeneralCommon.M_CN1.State != 0)
                {
                    GeneralCommon.M_CN1.Close();
                }
                GeneralCommon.Gp_MsgBoxDisplay((string)("Gf_ExecProcedure Error : " + ex.Message), "", "");
            }

            return(returnValue);
        }
예제 #3
0
        protected override void InternalBeginTransaction(SQLIsolationLevel isolationLevel)
        {
            switch (isolationLevel)
            {
            case SQLIsolationLevel.ReadUncommitted: _connection.IsolationLevel = ADODB.IsolationLevelEnum.adXactReadUncommitted; break;

            case SQLIsolationLevel.ReadCommitted: _connection.IsolationLevel = ADODB.IsolationLevelEnum.adXactReadCommitted; break;

            case SQLIsolationLevel.RepeatableRead: _connection.IsolationLevel = ADODB.IsolationLevelEnum.adXactRepeatableRead; break;

            case SQLIsolationLevel.Serializable: _connection.IsolationLevel = ADODB.IsolationLevelEnum.adXactSerializable; break;

            default: _connection.IsolationLevel = ADODB.IsolationLevelEnum.adXactUnspecified; break;
            }
            _nestingLevel = _connection.BeginTrans();
        }