protected void Page_Load(object sender, EventArgs e) { string tempurl = Utils.GetStaticPageNumbersHtml(2, 100, "showforum", ".aspx", 8); DbParameter[] prams = { DbHelper.MakeInParam("@name", DbType.String, 3,"aabbccdd") }; DbHelper.ExecuteNonQuery(CommandType.Text, "INSERT INTO itca_test(name) VALUES (@name)", prams); DbDataReader dr = DbHelper.ExecuteReader(CommandType.Text, "SELECT * FROM wy_articles"); while (dr.Read()) { Response.Write(dr["title"].ToString()+"<br />"+ dr["content"].ToString()); } if (Request.QueryString["a"] != null) { Response.Write(Request.QueryString["a"].ToString()); } TinyCache tc = new TinyCache(); tc.AddObject("test", "bbbbb"); Response.Write("TinyCache:" + tc.RetrieveObject("test") as string); System.Collections.Generic.SortedList<int, object> list = new System.Collections.Generic.SortedList<int, object>(); list.Add(1, "协会公告"); list.Add(2, "协会新闻"); object aaaa = list[1]; }
protected void Page_Load(object sender, EventArgs e) { DbHelper.ResetDbProvider(); DbHelper.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("~/App_Data/db.mdb"); DbHelper.Dbtype = "Access"; DataTable dt = DbHelper.ExecuteDataset(CommandType.Text, "SELECT * FROM i_news").Tables[0]; gvPreData.DataSource = dt; gvPreData.DataBind(); TinyCache cache = new TinyCache(); cache.AddObject("dt", dt); }
/// <summary> /// 取得栏目列表 /// </summary> /// <returns></returns> public static List<ColumnInfo> GetColumnCollection() { List<ColumnInfo> coll; TinyCache cache = new TinyCache(); coll = cache.RetrieveObject("ColumnList") as List<ColumnInfo>; if (coll == null) { coll = new List<ColumnInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetArticleColumnList(); while (reader.Read()) { coll.Add(DataReader2ColumnInfo(reader)); } reader.Close(); cache.AddObject("ColumnList", coll); } return coll; }