ST_Admin_addpro.aspx.cs
上传用户:wyx_1982
上传日期:2020-04-18
资源大小:699k
文件大小:2k
源码类别:

SCSI/ASPI

开发平台:

Others

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Web;
  7. using System.Web.SessionState;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.HtmlControls;
  11. namespace ST_GROUP.EnterpriseOnlineInfoManage
  12. {
  13. /// <summary>
  14. /// ST_Admin_addpro 的摘要说明。
  15. /// </summary>
  16. public partial class ST_Admin_addpro : System.Web.UI.Page
  17. {
  18. ST_DataBase ST_database = new ST_DataBase();
  19. protected void Page_Load(object sender, System.EventArgs e)
  20. {
  21. if (Session["admin"] == null)
  22. {
  23. //Response.Write("<script>alert("您还没有登录,不能进行接下来的操作,请登录后断续!");</script>");
  24. Response.Redirect("ST_contraller.aspx?cname=noadmin");
  25. }// 在此处放置用户代码以初始化页面
  26. if(!Page.IsPostBack)
  27. {
  28. DataTable ST_dt = new DataTable();
  29. string ST_strsql = "select * from ST_tClass";
  30. ST_dt = ST_database.ReadTable(ST_strsql);
  31. DropDownList1.DataSource = ST_dt;
  32. DropDownList1.DataTextField = "ST_className";
  33. DropDownList1.DataValueField = "ST_className";
  34. DropDownList1.DataBind();
  35. }
  36. }
  37. #region Web 窗体设计器生成的代码
  38. override protected void OnInit(EventArgs e)
  39. {
  40. //
  41. // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
  42. //
  43. InitializeComponent();
  44. base.OnInit(e);
  45. }
  46. /// <summary>
  47. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  48. /// 此方法的内容。
  49. /// </summary>
  50. private void InitializeComponent()
  51. {    
  52. }
  53. #endregion
  54. protected void Button1_Click(object sender, System.EventArgs e)
  55. {
  56. string ST_strsql;
  57. ST_strsql = "insert into ST_tProduct (ST_productname,ST_productprice,ST_productpic,ST_productclass,ST_productinfo,ST_prolibnow) values ('"+ TextBox1.Text +"','"+ TextBox2.Text +"','" + TextBox3.Text + "','"+ DropDownList1.SelectedValue +"','"+ TextBox5.Text +"',0)";
  58. ST_database.execsql(ST_strsql);
  59. Response.Write("<script>alert("产品添加成功!");</script>");
  60. TextBox1.Text = "";
  61. TextBox2.Text = "";
  62. TextBox3.Text = "";
  63. TextBox5.Text = "";
  64. }
  65. }
  66. }