Chinaunix首页 | 论坛 | 博客
  • 博客访问: 70732
  • 博文数量: 42
  • 博客积分: 2025
  • 博客等级: 大尉
  • 技术积分: 437
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-03 12:17
文章分类

全部博文(42)

文章存档

2010年(12)

2009年(30)

我的朋友

分类:

2009-11-23 15:11:01

第二部分

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

HiddenField1.Value = Session["UserName"].ToString();

Label1.Text = HiddenField1.Value;

getdata();

}

}

protected void getdata()

{

myco = new MySqlConnection(strconn);

myco.Open();

string IDUSE_ = HiddenField1.Value;

string sql = "select * from logtable where IDUSE= '" + IDUSE_ + "'";

MySqlDataAdapter myAdapter = new MySqlDataAdapter(sql, myco);

DataSet ds = new DataSet();

myAdapter.Fill(ds);

DataList1.DataSource = ds.Tables[0];

DataList1.DataKeyField = "IDRizhi";

DataList1.DataBind();

ds.Dispose();

myAdapter.Dispose();

myco.Close();

}

protected void DataList1_ItemDataBound(object source, DataListItemEventArgs e)

{

 ((LinkButton)e.Item.Controls[0].FindControl("LinkButton1")).Attributes.Add("onclick", "return confirm('您确定要删除吗?')");

}

protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e)

{

int IDRizhi_ = Int32.Parse(DataList1.DataKeys[e.Item.ItemIndex].ToString());

myco = new MySqlConnection(strconn);

myco.Open();

string sql = "delete  from logtable where IDRizhi=" + IDRizhi_ + "";

mycomm = new MySqlCommand(sql, myco);

dr = mycomm.ExecuteReader();

mycomm.Dispose();

Label4.Text = "已删除";

getdata();

}

 

 

限制标题长度,设置MaxLength50

条件判断

if (Title == "")

{           

TextBox1.Focus();

Label3.Visible = true;

Label3.Text = "标题不能为空";

}

else

{

要执行的操作

}

 

 

查询日志要做的操作

按日期查,按标题查

UserLogQue.aspx

按标题查找

 

模糊查询

SELECT * FROM logtable l where Title like '%页面%';

阅读(254) | 评论(0) | 转发(0) |
0

上一篇:信息系统

下一篇:按日期查询日志

给主人留下些什么吧!~~