public static int Retrieve(Entity en, string sql, Paras paras) { DataTable dt; switch (en.EnMap.EnDBUrl.DBUrlType) { case DBUrlType.AppCenterDSN: dt = DBAccess.RunSQLReturnTable(sql, paras); break; case DBUrlType.DBAccessOfMSMSSQL: dt = DBAccessOfMSMSSQL.RunSQLReturnTable(sql); break; case DBUrlType.DBAccessOfOracle: dt = DBAccessOfOracle.RunSQLReturnTable(sql); break; default: throw new Exception("@没有设置DB类型。"); } if (dt.Rows.Count == 0) { return(0); } Attrs attrs = en.EnMap.Attrs; EntityDBAccess.fullDate(dt, en, attrs); int i = dt.Rows.Count; dt.Dispose(); return(i); }
/// <summary> /// 查询 /// </summary> /// <param name="en">实体</param> /// <param name="sql">组织的查询语句</param> /// <returns></returns> public static int Retrieve(Entity en, string sql) { try { DataTable dt = new DataTable(); switch (en.EnMap.EnDBUrl.DBUrlType) { case DBUrlType.AppCenterDSN: dt = DBAccess.RunSQLReturnTable(sql); break; case DBUrlType.DBAccessOfMSSQL1: dt = DBAccessOfMSSQL1.RunSQLReturnTable(sql); break; case DBUrlType.DBAccessOfMSSQL2: dt = DBAccessOfMSSQL2.RunSQLReturnTable(sql); break; case DBUrlType.DBAccessOfOracle1: dt = DBAccessOfOracle1.RunSQLReturnTable(sql); break; case DBUrlType.DBAccessOfOracle2: dt = DBAccessOfOracle2.RunSQLReturnTable(sql); break; default: throw new Exception("@没有设置DB类型。"); } if (dt.Rows.Count == 0) { return(0); } Attrs attrs = en.EnMap.Attrs; EntityDBAccess.fullDate(dt, en, attrs); int i = dt.Rows.Count; dt.Dispose(); return(i); } catch (System.Exception ex) { throw ex; } }