using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace yn165.admin
{
	/// <summary>
	/// _005 的摘要说明。
	/// </summary>
	public class _005 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.TextBox sp_code;
		protected System.Web.UI.WebControls.TextBox sp_name;
		protected System.Web.UI.WebControls.TextBox explain;
		protected System.Web.UI.WebControls.TextBox price;
		protected System.Web.UI.WebControls.TextBox p_unit;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.DropDownList type;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

	
		

	

		private void Button1_Click(object sender, System.EventArgs e)
		{
			string sp_code="",sp_name="",explain="",price="",p_unit="",type="";
			sp_code=this.sp_code.Text;
			sp_name=this.sp_name.Text;
			explain=this.explain.Text;
			p_unit=this.p_unit.Text;
			type=this.type.SelectedItem.Text;
			price=this.price.Text;

			SqlConnection conn = new SqlConnection("server=211.155.254.117;database=yn165;uid=yn165;pwd=159753");
			conn.Open();
			string sql = "insert into shangping (sp_code,sp_name,explain,price,p_unit,type) values('" + 
				sp_code + "','" + sp_name + "','" + explain + "','" + price + "','" + p_unit + "','" + type + "')";
			SqlCommand cmd = new SqlCommand(sql,conn);
			cmd.ExecuteNonQuery();
			cmd.Dispose();
			conn.Close();
		
		}
	}
}
