예제 #1
0
 /// <summary>
 /// 执行命令返回受影响行数
 /// </summary>
 /// <returns></returns>
 public int ExecNonCmd()
 {
     try
     {
         OpenDb();
         CreateSqlCmd();
         int i = 0;
         i = MysqlCmd.ExecuteNonQuery();
         return(i);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
     finally
     {
         CloseDb();
     }
 }
예제 #2
0
        /// <summary>
        /// 执行命令返回是否操作成功,执行完不关闭连接
        /// 适用于外部启用事务调用
        /// </summary>
        /// <returns></returns>
        public bool BExecNonCmd()
        {
            bool retBool = false;

            try
            {
                OpenDb();
                CreateSqlCmd();
                int i = 0;
                i       = MysqlCmd.ExecuteNonQuery();
                retBool = true;
            }
            catch (Exception ex)
            {
                retBool = false;
                throw new Exception(ex.Message, ex);
            }

            return(retBool);
        }