📄 mythings.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace xajh.chat
{
/// <summary>
/// mythings 的摘要说明。
/// </summary>
public class mythings : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList things;
protected System.Web.UI.WebControls.Label msg;
protected System.Web.UI.WebControls.DropDownList showkind;
private void Page_Load(object sender, System.EventArgs e)
{
if (this.Session["info"] == null)
{
this.Server.Transfer ("../error.aspx?v=relogin");
}
this.showkind.DataSource = var.public_shoptype.Split('|');
this.showkind.DataBind();
this.showkind.Items.Insert(0, "所有类型");
x.UserInfo info = (x.UserInfo) this.Session["info"];
string sql;
string selectv = this.Request.QueryString["showkind"];
if (selectv == null)
{
sql = "";
this.showkind.Items[0].Selected = true;
}
else
{
selectv = selectv.Replace("|", "").Replace("'", "");
if (("|" + var.public_shoptype + "|").IndexOf("|" + selectv + "|") == -1)
{
sql = "";
this.showkind.SelectedIndex = 0;
}
else
{
sql = " and [类型]='" + selectv + "'";
this.showkind.Items.FindByText(selectv).Selected = true;
}
}
DataSet ds = new DataSet();
OleDbConnection MyConn = new OleDbConnection(var.public_conn);
MyConn.Open();
OleDbDataAdapter MyAdapter = new OleDbDataAdapter(@"select * from [拥有物品] where [拥有]='" + info.UserName + "'" + sql,MyConn);
MyAdapter.Fill(ds,"拥有物品");
MyConn.Close();
MyConn.Dispose();
things.DataSource = ds.Tables["拥有物品"].DefaultView;
things.DataBind();
if (ds.Tables["拥有物品"].Rows.Count == 0)
{
this.msg.Text = "没有物品被显示";
}
else
{
this.msg.Text = "";
}
ds.Dispose();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -