Beispiel #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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 protected override void InternalRollbackTransaction()
 {
     _connection.RollbackTrans();
     _nestingLevel--;
 }