protected void dlContent_DeleteCommand(object source, DataListCommandEventArgs e) { string ID = this.dlContent.DataKeys[e.Item.ItemIndex].ToString(); string sqlstr = "delete from tb_tools where ID='" + Convert.ToInt32(ID) + "'"; EP.EXECCommand(sqlstr);//执行删除语句 this.bindDataList(); }
protected void dlTouxiang_DeleteCommand(object source, DataListCommandEventArgs e) { //获取主键字段的字段值,并且将获取的字段的值赋值给变量ID中 string ID = this.dlTouxiang.DataKeys[e.Item.ItemIndex].ToString(); string sqlstr = "delete from tb_image where id='" + Convert.ToInt32(ID) + "'"; EP.EXECCommand(sqlstr); //调用EP类的EXECCommand方法执行删除语句 this.bindDataList(); //调用用户自定义bindDataList方法 }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { String SqlUpdate = "Update tb_New set title='" + this.TextBox2.Text + "',content='" + this.TxtContent.Text + "',PublishTime='" + this.TxtTime.Text + "',PublishPerson='" + this.TxtPerson.Text + "',ComeFrom='" + this.TxtComeFrom.Text + "' where id='" + this.Txtid.Text + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!新闻信息修改成功!');location='AdminNew.aspx'</script>");//弹出对话框显示“恭喜您!!新闻信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!新闻信息修改失败!');location='AdminNew.aspx'</script>");//弹出对话框显示“很遗憾!!新闻信息修改失败!” } }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { String SqlUpdate = "Update tb_leibie set name='" + this.TxtName.Text + "',ADDTime='" + this.TxtTime.Text + "' where id='" + Request["id"] + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!产品类别信息修改成功!');location='AdminLeibie.aspx'</script>");//弹出对话框显示“恭喜您!!产品类别信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!产品类别信息修改失败!');location='AdminLeibie.aspx'</script>");//弹出对话框显示“很遗憾!!产品类别信息修改失败!” } }
protected void btnupdate_Click(object sender, EventArgs e) { try { String SqlUpdate = "Update tb_FriendLink set AddTime='" + this.TxtTime.Text + "',LinkAddress='" + this.txtAddress.Text + "',LinkImage='" + this.ddlPhoto.Text + "' where id='" + Request["id"] + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!友情链接信息修改成功!');location='AdminFriendLink.aspx'</script>");//弹出对话框显示“恭喜您!!友情链接信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!友情链接信息修改失败!');location='AdminFriendLink.aspx'</script>");//弹出对话框显示“很遗憾!!友情链接信息修改失败!” } }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { String SqlUpdate = "Update tb_tools set Name='" + this.TxtName.Text + "',Edition='" + this.TxtEdition.Text + "',Condition='" + this.TxtCondition.Text + "',Price='" + this.TxtPrice.Text + "',EditionIntro='" + this.TxtIntroEdition.Text + "',LeiBie='" + this.Txtleibie.Text + "' ,type='" + this.ddlType.SelectedItem.Text + "',Point='" + this.TxtPoint.Text + "',ToolSize='" + this.TxtSize.Text + "',UpTime='" + this.TxtTime.Text + "', Intro='" + this.TxtIntro.Text + "' ,Image='" + this.DDlToolsImage.SelectedItem.Text + "',download='" + this.DDLTools.SelectedItem.Text + "' where id='" + Request["id"] + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!工具软件修改成功!');location='AdminTools.aspx'</script>");//弹出对话框显示“恭喜您!!工具软件修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!工具软件修改失败!');location='AdminTools.aspx'</script>");//弹出对话框显示“很遗憾!!工具软件修改失败!” } }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { String SqlDelete = "Delete from tb_leibie where id='" + Request["id"] + "'"; EP.EXECCommand(SqlDelete); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!产品类别信息删除成功!');location='AdminLeibie.aspx'</script>");//弹出对话框显示“恭喜您!!产品类别信息删除成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!产品类别信息删除失败!');location='AdminLeibie.aspx'</script>");//弹出对话框显示“很遗憾!!产品类别信息删除失败!” } }
protected void Button2_Click(object sender, EventArgs e) { try { String SqlDelete = "Delete from tb_New where id='" + this.TextBox1.Text + "'"; EP.EXECCommand(SqlDelete); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!新闻信息删除成功!');location='AdminNew.aspx'</script>");//弹出对话框显示“恭喜您!!新闻信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!新闻信息删除失败!');location='AdminNew.aspx'</script>");//弹出对话框显示“很遗憾!!新闻信息修改失败!” } }
protected void btnupdate_Click(object sender, EventArgs e) { try { String SqlDelete = "Delete from tb_FriendLink where id='" + this.TxtId.Text + "'"; EP.EXECCommand(SqlDelete); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!友情链接信息删除成功!');location='AdminFriendLink.aspx'</script>");//弹出对话框显示“恭喜您!!友情链接信息删除成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!友情链接信息删除失败!');location='AdminFriendLink.aspx'</script>");//弹出对话框显示“很遗憾!!友情链接信息删除失败!” } }
protected void Button1_Click(object sender, EventArgs e) { try { String SqlDelete = "Delete tb_LeaveWord where id='" + Request["id"] + "'"; EP.EXECCommand(SqlDelete); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!留言信息删除成功!');location='javascript:history.go(-1)'</script>");//弹出对话框显示“恭喜您!!留言信息删除成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!留言信息删除失败!');location='javascript:history.go(-1)'</script>");//弹出对话框显示“很遗憾!!留言信息删除失败!” } }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { String SqlUpdate = "Update tb_UserLogin set UserName='******',role='" + this.DdlRole.SelectedItem.Text + "',TrueName='" + this.TxtTrueName.Text + "',RetakePassword='******',AnswerPassWord='******',sex='" + this.ddlSex.SelectedItem.Text + "' ,Age='" + this.TxtAge.Text + "',phone='" + this.TxtTel.Text + "',Email='" + this.TxtEmail.Text + "',QQ='" + this.TxtQQ.Text + "', Address='" + this.TxtIntro.Text + "' ,homepage='" + this.Txthomepage.Text + "',Intro='" + this.TxtIntro.Text + "',Image='" + this.ddlPhoto.SelectedItem.Text + "' where UserId='" + Request["UserId"] + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!用户信息修改成功!');location='AdminUser.aspx'</script>");//弹出对话框显示“恭喜您!!用户信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!用户信息修改失败!');location='AdminUser.aspx'</script>");//弹出对话框显示“很遗憾!!用户信息修改失败!” } }
protected void BtnDelete_Click(object sender, EventArgs e) { try { String SqlUpdate = "Delete from tb_UserLogin where UserId='" + Request["UserId"] + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!用户信息修改成功!');location='AdminUser.aspx'</script>");//弹出对话框显示“恭喜您!!用户信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!用户信息修改失败!');location='AdminUser.aspx'</script>");//弹出对话框显示“很遗憾!!用户信息修改失败!” } }
protected void Button1_Click(object sender, EventArgs e) { try { String SqlUpdate = "Update tb_LeaveWord set Title='" + this.TexTitle.Text + "',lTime='" + this.TexTime.Text + "',person='" + this.TexPerson.Text + "',Content='" + this.TexContent.Text + "',RevertContent='" + this.TxtReply.Text + "' where id='" + Request["id"] + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!留言信息修改成功!');location='AdminLeaveWord.aspx'</script>");//弹出对话框显示“恭喜您!!留言信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!留言信息修改失败!');location='AdminLeaveWord.aspx'</script>");//弹出对话框显示“很遗憾!!留言信息修改失败!” } }
protected void BtnUpdate_Click(object sender, EventArgs e) { try { String SqlUpdate = "Update tb_GongGao set title='" + this.TextBox1.Text + "',content='" + this.TextBox2.Text + "'where id='" + this.Txtid.Text + "'"; EP.EXECCommand(SqlUpdate); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!公告信息修改成功!');location='AdminGongGao.aspx'</script>");//弹出对话框显示“恭喜您!!公告信息修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!公告信息修改失败!');location='AdminGongGao.aspx'</script>");//弹出对话框显示“很遗憾!!公告信息修改失败!” } }
protected void btnChange_Click(object sender, EventArgs e) { if (Session["ID"] != null) { string Sql = "update tb_UserLogin set UserPwd='" + this.txtOKpwd.Text + "' where UserName='******'"; int i = EP.EXECCommand(Sql); if (i > 0) { Response.Write("<script language=javascript>alert('恭喜您,修改成功!');location='../default.aspx'</script>"); } else { Response.Write("<script language=javascript>alert('很遗憾,修改失败!');location='javascript:history.go(-1)'</script>"); } } }
protected void ImgBtnReg_Click(object sender, ImageClickEventArgs e) { try { //将信息插入到注册登录信息表中 string InsertStr = "insert into tb_UserLogin values('" + this.TxtUserName.Text + "','" + this.TxtUserPwd.Text + "','" + this.TxtTruePwd.Text + "','" + this.DdlRole.SelectedItem.Text + "','" + this.TxtTrueName.Text + "','" + this.TxtRetakePwd.Text + "','" + this.txtAnswerPassWord.Text + "','" + this.ddlSex.SelectedItem.Text + "','" + this.TxtAge.Text + "','" + this.TxtTel.Text + "','" + this.TxtEmail.Text + "','" + this.TxtQQ.Text + "','" + this.TxtAddress.Text + "','" + this.Txthomepage.Text + "','" + this.TxtIntro.Text + "','" + this.ddlPhoto.SelectedItem.Text + "')"; EP.EXECCommand(InsertStr); //调用EP类中的静态EXECCommand方法,执行SQL语句 //注册成功后弹出对话框,显示"恭喜您!!注册成功!" Response.Write("<script lanuage='javaScript'>alert('恭喜您!!注册成功!');location='../Default.aspx'</script>"); //弹出对话框显示“恭喜您!!注册成功!” } catch { //注册失败后弹出对话框,显示"很遗憾!!注册失败!" Response.Write("<script lanuage='javaScript'>alert('很遗憾!!注册失败!');location='../Default.aspx'</script>");//弹出对话框显示“很遗憾!!注册失败!” } }
protected void BtnAdd_Click(object sender, EventArgs e) { if (this.TxtName.Text == "" && this.TxtTime.Text == "") { Response.Write("<script lanuage='javaScript'>alert('文本框不能为空!');location='Adminleibie_ADD.aspx'</script>"); } else { try { String SqlInsert = "insert into tb_leibie values('" + this.TxtName.Text + "','" + this.TxtTime.Text + "')"; EP.EXECCommand(SqlInsert); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!类别信息添加成功!');location='Adminleibie.aspx'</script>");//弹出对话框显示“恭喜您!!类别信息添加成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!类别信息添加失败!');location='Adminleibie.aspx'</script>");//弹出对话框显示“很遗憾!!类别信息添加失败!” } } }
protected void BtnAdd_Click(object sender, EventArgs e) { if (this.TxtName.Text == "" || this.TxtEdition.Text == "" || this.TxtCondition.Text == "" || this.TxtPrice.Text == "" || this.TxtIntroEdition.Text == "" || this.TxtPoint.Text == "" || this.TxtSize.Text == "" || this.TxtTime.Text == "" || this.TxtIntro.Text == "") { Response.Write("<script lanuage='javaScript'>alert('文本框不能为空!');location='AdminTools_Add.aspx'</script>"); } else { try { String SqlInsert = "Insert tb_tools values ('" + this.TxtName.Text + "','" + this.TxtEdition.Text + "','" + this.TxtCondition.Text + "','" + this.TxtPrice.Text + "','" + this.TxtIntroEdition.Text + "','" + this.ddllb.SelectedItem.Text + "' ,'" + this.ddlType.SelectedItem.Text + "','" + this.TxtPoint.Text + "','" + this.TxtSize.Text + "','" + this.TxtTime.Text + "','" + this.TxtIntro.Text + "' ,'" + this.DDlToolsImage.SelectedItem.Text + "','" + this.DDLTools.SelectedItem.Text + "')"; EP.EXECCommand(SqlInsert); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!工具软件添加成功!');location='AdminTools.aspx'</script>");//弹出对话框显示“恭喜您!!工具软件修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!工具软件添加失败!');location='AdminTools.aspx'</script>");//弹出对话框显示“很遗憾!!工具软件修改失败!” } } }
protected void BtnLiuYan_Click(object sender, EventArgs e) { if (this.TxtTitle.Text == "" && this.TxtContent.Text == "" && this.TxtPerson.Text == "" && this.TxtTime.Text == "") { Response.Write("<script lanuage='javaScript'>alert('文本框不能为空!');location='liuyan.aspx'</script>"); } else { try { String SqlInsert = "insert into tb_LeaveWord(Title,lTime,person,Content) values('" + this.TxtTitle.Text + "','" + this.TxtTime.Text + "','" + this.TxtPerson.Text + "','" + this.TxtContent.Text + "')"; EP.EXECCommand(SqlInsert); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!留言信息添加成功!');location='Default.aspx'</script>");//弹出对话框显示“恭喜您!!留言信息添加成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!留言信息添加失败!');location='Default.aspx'</script>");//弹出对话框显示“很遗憾!!留言信息添加失败!” } } }
protected void BtnAdd_Click(object sender, EventArgs e) { if (this.Txtid.Text == "" && this.TxtTitle.Text == "" && this.TxtContent.Text == "" && this.TxtTime.Text == "" && this.TxtPerson.Text == "" && this.TxtComeFrom.Text == "") { /*如果文本框为空,弹出提示对话框,显示“文本框不能为空”提示信息,并且将页面跳回到新闻信息添加页面“AdminNew_Add.aspx”中*/ Response.Write("<script lanuage='javaScript'>alert('文本框不能为空!');location='AdminNew_Add.aspx'</script>"); } else { try { String SqlInsert = "insert into tb_New values('" + this.Txtid.Text + "','" + this.TxtTitle.Text + "','" + this.TxtContent.Text + "','" + this.TxtTime.Text + "','" + this.TxtPerson.Text + "','" + this.TxtComeFrom.Text + "')"; EP.EXECCommand(SqlInsert); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!新闻信息添加成功!');location='AdminNew.aspx'</script>");//弹出对话框显示“恭喜您!!公告信息添加成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!新闻信息添加失败!');location='AdminNew.aspx'</script>");//弹出对话框显示“很遗憾!!公告信息添加失败!” } } }
protected void Button2_Click(object sender, EventArgs e) { string s = DateTime.Now.ToShortDateString(); if (this.Txtid.Text == "" && this.TextBox1.Text == "" && this.TextBox2.Text == "") { Response.Write("<script lanuage='javaScript'>alert('文本框不能为空!');location='AdminGongGao_Add.aspx'</script>"); } else { try { String SqlInsert = "insert into tb_GongGao values('" + this.Txtid.Text + "','" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + s + "')"; EP.EXECCommand(SqlInsert); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!公告信息添加成功!');location='AdminGongGao.aspx'</script>");//弹出对话框显示“恭喜您!!公告信息添加成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!公告信息添加失败!');location='AdminGongGao.aspx'</script>");//弹出对话框显示“很遗憾!!公告信息添加失败!” } } }
protected void BtnAdd_Click(object sender, EventArgs e) { if (this.TxtUserName.Text == "" && this.TxtUserPwd.Text == "" && this.TxtTruePwd.Text == "" && this.TxtTrueName.Text == "" && this.TxtRetakePwd.Text == "" && this.txtAnswerPassWord.Text == "" && this.TxtAge.Text == "" && this.TxtTel.Text == "" && this.TxtEmail.Text == "" && this.TxtQQ.Text == "" && this.TxtAddress.Text == "" && this.Txthomepage.Text == "" && this.TxtIntro.Text == "") { //弹出提示对话框,跳转到AdminUser_Add.aspx页面中 Response.Write("<script lanuage='javaScript'>alert('文本框不能为空!');location='AdminUser_Add.aspx'</script>"); } else { try { //使用Insert语句将用户信息插入到tb_UserLogin数据表中 string InsertStr = "insert into tb_UserLogin values('" + this.TxtUserName.Text + "','" + this.TxtUserPwd.Text + "','" + this.TxtTruePwd.Text + "','" + this.DdlRole.SelectedItem.Text + "','" + this.TxtTrueName.Text + "','" + this.TxtRetakePwd.Text + "','" + this.txtAnswerPassWord.Text + "','" + this.ddlSex.SelectedItem.Text + "','" + this.TxtAge.Text + "','" + this.TxtTel.Text + "','" + this.TxtEmail.Text + "','" + this.TxtQQ.Text + "','" + this.TxtAddress.Text + "','" + this.Txthomepage.Text + "','" + this.TxtIntro.Text + "','" + this.ddlPhoto.SelectedItem.Text + "')"; //调用EP类中的EXECCommand方法,执行Insert插入语句 EP.EXECCommand(InsertStr); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!用户添加成功!');location='AdminUser_Add.aspx'</script>");//弹出对话框显示“恭喜您!!用户添加成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!用户添加失败!');location='AdminUser_Add.aspx'</script>");//弹出对话框显示“很遗憾!!用户添加失败!” } } }
protected void btnAdd_Click(object sender, EventArgs e) { string FullFileName = this.FileUpload1.PostedFile.FileName; string fileName = FullFileName.Substring(FullFileName.LastIndexOf("\\") + 1); string type = fileName.Substring(fileName.LastIndexOf(".") + 1); if (type == "rar") { if (this.FileUpload1.PostedFile.FileName != "") //if(FileUpload1.HasFile)//判断是否选择上传文件 { UpFile();//执行上传文件 SFUPC(); } else { Response.Write("<script language='javascript'>alert('不可以为空');location='javascript:history.go(-1)'</script>"); } try { this.LblSoft.Text = "Mend/" + this.LblSoft.Text; String SqlInsert = "Insert tb_uptools values ('" + this.LblSoft.Text + "')"; EP.EXECCommand(SqlInsert); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!添加成功!');location='AdminTools.aspx'</script>");//弹出对话框显示“恭喜您!!修改成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!添加失败!');location='AdminTools.aspx'</script>");//弹出对话框显示“很遗憾!!修改失败!” } } else { Response.Write("<script lanuage='javaScript'>alert('你上传的格式有误!');location='javascript:history.go(-1)'</script>"); } }
protected void btnAdd_Click(object sender, EventArgs e) { string FullFileName = this.FileUpload1.PostedFile.FileName; string fileName = FullFileName.Substring(FullFileName.LastIndexOf("\\") + 1); string type = fileName.Substring(fileName.LastIndexOf(".") + 1); if (type == "bmp" || type == "BMP" || type == "jpg" || type == "JPG" || type == "gif" || type == "GIF") { if (this.FileUpload1.PostedFile.FileName != "") //if(FileUpload1.HasFile)//判断是否选择上传文件 { UpFile();//执行上传文件 SFUPC(); } else { Response.Write("<script language='javascript'>alert('不可以为空');location='javascript:history.go(-1)'</script>"); } try { this.LblImage.Text = "~/FriendLinkImage/" + this.LblImage.Text; String SqlAdd = "Insert into tb_FriendLink values('" + this.txtAddress.Text + "','" + this.TxtTime.Text + "','" + this.LblImage.Text + "')"; EP.EXECCommand(SqlAdd); Response.Write("<script lanuage='javaScript'>alert('恭喜您!!友情链接信息添加成功!');location='AdminFriendLink.aspx'</script>");//弹出对话框显示“恭喜您!!友情链接信息添加成功!” } catch { Response.Write("<script lanuage='javaScript'>alert('很遗憾!!友情链接信息添加失败!');location='AdminFriendLink.aspx'</script>");//弹出对话框显示“很遗憾!!友情链接信息添加失败!” } } else { Response.Write("<script lanuage='javaScript'>alert('你上传的格式有误!');location='javascript:history.go(-1)'</script>"); } }
protected void ImgBtndownLoad_Click(object sender, ImageClickEventArgs e) { string id = Request["IdToolsDownLoad"]; DataSet ds = null; if (Request["ID"] != null) { ds = ep.ReturnDataSet("select * from tb_tools where id='" + Request["ID"] + "'", "tb_tools"); DataRowView rv = ds.Tables["tb_tools"].DefaultView[0]; this.lblName.Text = rv["downLoad"].ToString(); } if (Request["Mendid"] != null) { ds = ep.ReturnDataSet("select * from tb_tools where id='" + Request["Mendid"] + "'", "tb_tools"); DataRowView rv = ds.Tables["tb_tools"].DefaultView[0]; this.lblName.Text = rv["downLoad"].ToString(); } if (Request["downloadid"] != null) { ds = ep.ReturnDataSet("select * from tb_tools where id='" + Request["downloadid"] + "'", "tb_tools"); DataRowView rv = ds.Tables["tb_tools"].DefaultView[0]; this.lblName.Text = rv["downLoad"].ToString(); } if (Request["IdToolsDownLoad"] != null) { ds = ep.ReturnDataSet("select * from tb_tools where id='" + Request["IdToolsDownLoad"] + "'", "tb_tools"); DataRowView rv = ds.Tables["tb_tools"].DefaultView[0]; this.lblName.Text = rv["downLoad"].ToString(); } if (Request["IdToolsMend"] != null) { ds = ep.ReturnDataSet("select * from tb_tools where id='" + Request["IdToolsMend"] + "'", "tb_tools"); DataRowView rv = ds.Tables["tb_tools"].DefaultView[0]; this.lblName.Text = rv["downLoad"].ToString(); } string strPath = Server.MapPath("./Mend/") + this.lblName.Text; //获得产品的路径,并存储在一个字符串中 if (strPath != "") //判断产品路径是否存在 { FileInfo FInfo = new FileInfo(strPath); //使用获得的路径实例化FileInfo对象 if (FInfo.Exists) //判断产品是否存在 { Response.Clear(); //清空缓冲区 Response.ClearHeaders(); //清空缓冲区头 Response.Buffer = false; //设置Response对象不可以缓冲输出 Response.ContentType = "application/octet-stream"; //设置输出流的HTTP MIME类型 //将HTTP头添加到输出流 Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FInfo.FullName, System.Text.Encoding.UTF8)); //将要下载的产品的大小添加到输出流 Response.AppendHeader("Content-Length", FInfo.Length.ToString()); Response.WriteFile(FInfo.FullName); //将指定的要下载的信息产品写入输出流 Response.Flush(); //向客户端发送当前所有缓冲的输出 //修改产品下载次数信息,即每单击一次“下载”按钮,将下载次数增加一次 string str = "update tb_tools set Point=Point+1 where id='" + this.LblID.Text + "'"; EP.EXECCommand(str);//调用EP类中的EXECCommand方法,执行Update语句 } else { Response.Write("<script>alert('很遗憾,该文件暂时不存在!');location='../Default.aspx'</script>"); } } }