- using System;
- using System.Data;
- using System.Data.OleDb;//ACCESS
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class _Default : System.Web.UI.Page
- {
- public void page_Load(Object sender, EventArgs e)
- {
- //OleDbConnection conn = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("liuyin_data/data.mdb") + ";");
- OleDbConnection conn = liuyinconn.connstr();
- try
- {
- conn.Open();//打开数据库链接 ;
- //Response.Write("链接成功!");
- conn.Close();//关闭数据库链接;
- }
- catch
- {
- // Response.Write("参数错误!");
- }
- }
- public string msg_top()
- //留言列表
- {
- string msg_top = "";
- try
- {
- OleDbConnection conn = liuyinconn.connstr();
- string TableName = "yl_message";
- string sql = "Select TOP 10 * FROM [" + TableName + "] WHERE yl_sh=0 ORDER BY yl_adddate DESC";
- conn.Open();//打开数据库链接 ;
- OleDbCommand cmd = new OleDbCommand(sql, conn);
- OleDbDataReader rs = cmd.ExecuteReader();
- if (rs.HasRows)
- {
- while (rs.Read())
- {
- Response.Write("<div class='ct'>");
- Response.Write("<div class='cta'>");
- Response.Write("<strong> 标题:" + rs["yl_title"].ToString() + "</strong>");
- Response.Write("</div>");
- Response.Write("<div class='ctb'>");
- Response.Write("操作");//文字广告
- Response.Write("</div>");
- Response.Write("</div>");
- Response.Write("<div class='cl'>");
- Response.Write("<div class='clc'>");
- Response.Write("" + rs["yl_body"].ToString() + "");
- // Response.Write("<br><br>");
- // if (rs["yl_uid"].ToString() != "0")
- // {
- // Response.Write("<div class=review>");
- // Response.Write("" + rs["yl_uidHF"].ToString() + "");
- // Response.Write("</div>");
- // }
- Response.Write("</div>");
- Response.Write("<div class='clinfo'>");
- Response.Write("</div>");
- Response.Write("<div class='clin'>");
- Response.Write("<div class='lefts'>");
- Response.Write("<strong> </strong>");//文字广告
- Response.Write("</div>");
- Response.Write("<div class='rights'>");
- Response.Write("<strong> 发表:</strong>" + rs["yl_name"].ToString() + "");
- Response.Write("<strong> 时间:</strong>" + rs["yl_adddate"].ToString() + "");
- Response.Write("</div></div>");
- Response.Write("</div>");
- //Response.Write("<IMG src=skins/1/FACE/" + rs["yl_face"].ToString() + " border=0>");
- }
- }
- rs.Close();
- conn.Close();
- }
- catch
- {
- Response.Write("参数错误!");
- }
- return msg_top;
- }
- }