if (ds.Tables[0].Rows.Count == 0) {
Response.Write(\language='javascript'>alert('用户名输入错误!');history.back();\ Response.End();
} else {
string password_db = ds.Tables[0].Rows[0][\密码\ if (Password == password_db) {
Session[\用户名\
Response.Write(\language='javascript'>alert('登陆成功!');history.back();\ Response.End(); } else {
Response.Write(\language='javascript'>alert('密码输入错误!');history.back();\ Response.End();
} }
5.2用户注册模块实现
protected void btndl_Click(object sender, EventArgs e) {
string user = txtusername.Text.Trim(); string pwd = txtpwd.Text.Trim();
string pwdagain = txtpwdagain.Text.Trim(); string name = txtname.Text.Trim(); string Sex = sex.SelectedValue; string adress = txtdizhi.Text.Trim(); string phone = txtphone.Text.Trim();
string sqlString = \into 用户表 (用户名,密码,姓名,性别,联系地址,联系电话) values ('\phone + \
SqlConnection conn = new SqlConnection();
conn.ConnectionString = @\server=PC-31\\SQL2005; database=fuzhuang_DB;integrated security=sspi\ conn.Open();
15
SqlCommand cmd = new SqlCommand(sqlString, conn); if (cmd.ExecuteNonQuery() == -1) { this.Label13.Text = \注册失败!\ else
{ this.Label13.Text = \注册成功!\ conn.Close(); conn.Dispose(); }
protected void btnqx_Click(object sender, EventArgs e) {
this.txtusername.Text = \ this.txtpwd.Text = \ this.txtpwdagain.Text = \ this.txtname.Text = \ this.sex.Text = \ this.txtdizhi.Text = \ this.txtphone.Text = \ }
5.3商品详细信息模块实现
public partial class xiangxi1 : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
string id = Request.QueryString[\ SqlConnection conn = new SqlConnection();
conn.ConnectionString =@\security=sspi\
SqlDataAdapter sda = new SqlDataAdapter();
string sql = \服装表 where 服装编号=\ sda.SelectCommand = new SqlCommand(sql,conn); DataSet ds = new DataSet(); sda.Fill(ds);
fm.Text = ds.Tables[0].Rows[0][2].ToString(); ms.Text = ds.Tables[0].Rows[0][3].ToString(); cm.Text = ds.Tables[0].Rows[0][4].ToString(); ys.Text = ds.Tables[0].Rows[0][5].ToString(); nl.Text = ds.Tables[0].Rows[0][7].ToString(); jg.Text = ds.Tables[0].Rows[0][6].ToString();
image.ImageUrl = \
16
}
protected void btnbuy_Click(object sender, EventArgs e) {
Response.Redirect(\ } }
5.4商品分类模块实现
public partial class shangzhuang : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
string id = Request.QueryString[\ SqlConnection conn = new SqlConnection();
conn.ConnectionString = @\security=sspi\
SqlDataAdapter sda = new SqlDataAdapter();
string sql = \服装表.图片, dbo.服装表.服装名, dbo.服装表.价格, dbo.服装类型表.类型编号, dbo.服装表.类型编号 AS Expr1 FROM dbo.服装表 INNER JOIN dbo.服装类型表 ON dbo.服装表.类型编号 = dbo.服装类型表.类型编号 where dbo.服装类型表.类型编号='A'\
sda.SelectCommand = new SqlCommand(sql, conn); DataSet ds = new DataSet(); sda.Fill(ds); }
protected void btndl_Click(object sender, EventArgs e) { }
protected void btnzc_Click(object sender, EventArgs e) {
Response.Redirect(\ }
protected void LinkButton1_Click(object sender, EventArgs e) {
Response.Redirect(\ }
protected void LinkButton2_Click(object sender, EventArgs e) {
Response.Redirect(\ } }
17
5.5商品新增模块实现
protected void btnxz_Click(object sender, EventArgs e) {
string XZ = dpleixing.SelectedValue; string FB = txtfb.Text.Trim();
string FM = txtfm.Text.Trim(); string CM = txtcm.Text.Trim(); string YS = txtys.Text.Trim(); string JG = txtjg.Text.Trim(); string AGE = txtage.Text.Trim(); string SL = txtsl.Text.Trim();
string IMAGE = image.ImageUrl.ToString(); string MS = txtms.Text.Trim();
string sqlString = \into 服装表 (服装编号,类型编号,服装名,商品描述,尺码,颜色,价格,适用年龄,数量,图片) values ('\CM + \ SqlConnection conn = new SqlConnection(); conn.ConnectionString = @\server=PC-31\\SQL2005; database=fuzhuang_DB;integrated security=sspi\ conn.Open();
SqlCommand cmd = new SqlCommand(sqlString, conn); if (cmd.ExecuteNonQuery() == -1) {
Response.Write(\上传失败!');\ conn.Close(); } else {
Response.Write(\language='javascript'>alert('恭喜您上传成功!');\
conn.Close(); }
conn.Close(); conn.Dispose(); }
private string GetFilname() {
Random rnd = new Random();
18
int a = 1000; int b = 9999;
string str = string.Empty;
str += DateTime.Now.Year.ToString(); if (DateTime.Now.Month < 10) {
str += \
} else {
str += DateTime.Now.Month.ToString(); }
if (DateTime.Now.Day < 10) {
str += \ } else {
str += DateTime.Now.Day.ToString();
}
if (DateTime.Now.Hour < 10) {
str += \ } else {
str += DateTime.Now.Hour.ToString();
}
if (DateTime.Now.Minute < 10) {
str += \ } else {
str += DateTime.Now.Minute.ToString();
}
if (DateTime.Now.Second < 10) {
str += \ }
19