示例#1
0
        private static Int32 GetSubmit(BaseQuery o, string targetdb, out Exception outex)
        {
            //先判断是否是新增,如果不是新增就修改

            outex = null;
            o.Convert(targetdb);
            Int32 affectedCount = -1;

            try
            {
                if (o.excutParBag.excutEnum == ExcutEnum.Insert && ((ExcutParBag_Insert)o.excutParBag).isOutIdentity)
                {
                    affectedCount = DataAccess.ExecuteScalarToWriterOnlyForInsertRentrunIdentity(o, o.databaseProperty).ToSafeInt32(-1);
                }
                else
                {
                    affectedCount = DataAccess.ExecuteNonQuery(o, o.databaseProperty).ToSafeInt32(-1);
                }
            }
            catch (Exception ex)
            {
                outex = ex;
                LogService.Default.Fatal("执行失败:" + ex.Message, ex);
                affectedCount = -1;
            }
            finally
            {
            }
            return(affectedCount);
        }
示例#2
0
        internal static bool  Excut(this BaseQuery o)
        {
            o.Convert(o.Targetdb);
            int i = DataAccess.ExecuteNonQuery(o, o.databaseProperty);

            if (i >= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        internal static DataTable ReturnDataTable(this BaseQuery o, int tableIndex = 0)
        {
            o.Convert(o.Targetdb);
            DataSet Ds = DataAccess.ExecuteDataset(o, o.databaseProperty);

            if (Ds != null && Ds.Tables.Count > 0)
            {
                if (tableIndex > 0)
                {
                    return(Ds.Tables[tableIndex]);
                }
                else
                {
                    return(Ds.Tables[0]);
                }
            }
            return(null);
        }