public static T_ad_keys user_se_key() { StringBuilder str = new StringBuilder(); string sql = "select top 1 * from t_ad_keys order by id desc"; using (SqlDataReader dr = a.data.mssql.ExecuteReader(0, sql)) { T_ad_keys model = null; if (dr.Read()) { model = new T_ad_keys(); model.Id = a.normal.toInt(dr["id"]); model.Key_keys = a.normal.toString(dr["key_keys"]); model.Key_back = a.normal.toString(dr["key_back"]); } dr.Close(); dr.Dispose(); return model; } }
public static T_ad_keys admin_se_keys(int id) { string sql = "select * from t_ad_keys where id=@id"; using (SqlDataReader dr = a.data.mssql.ExecuteReader(0, sql, new SqlParameter[] { new SqlParameter("@id", id) })) { T_ad_keys key = null; while (dr.Read()) { key = new T_ad_keys(); key.Id = a.normal.toInt(dr["id"]); key.Key_back = a.normal.toString(dr["Key_back"]); key.Key_keys = a.normal.toString(dr["Key_keys"]); } dr.Close(); dr.Dispose(); return key; } }
public static List<T_ad_keys> admin_key(string tblName, string fldName, int PageSize, int PageIndex, string OrderType, string strWhere, out int Count) { SqlParameter[] parameters = { new SqlParameter("@tblName", SqlDbType.VarChar, 255), new SqlParameter("@strGetFields", SqlDbType.VarChar, 1000), new SqlParameter("@fldName", SqlDbType.VarChar, 255), new SqlParameter("@PageSize", SqlDbType.Int), new SqlParameter("@PageIndex", SqlDbType.Int), new SqlParameter("@strOrder", SqlDbType.VarChar,100), new SqlParameter("@strWhere", SqlDbType.VarChar,1500), new SqlParameter("@Count", SqlDbType.Int), }; parameters[0].Value = tblName; parameters[1].Value = "*"; parameters[2].Value = fldName; parameters[3].Value = PageSize; parameters[4].Value = PageIndex; parameters[5].Value = OrderType; parameters[6].Value = strWhere; parameters[7].Direction = ParameterDirection.Output; using (SqlDataReader dr = a.data.mssql.ExecuteReader(1, "[UP_PaginationAnyOrderCount]", parameters)) { List<T_ad_keys> list = new List<T_ad_keys>(); while (dr.Read()) { T_ad_keys key = new T_ad_keys(); key.Id = a.normal.toInt(dr["id"]); key.Key_back = a.normal.toString(dr["Key_back"]); key.Key_keys = a.normal.toString(dr["Key_keys"]); list.Add(key); } dr.Close(); dr.Dispose(); Count = a.normal.toInt(parameters[7].Value); return list; } }