📄 altergoods.ascx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class control_altergoods : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
// if (Convert.ToString(Session["username"]) == "")
//{
// Response.Write("<script language=javascript>alert('请登录');location='../login.aspx'</script>");
// return;
//}
if (!IsPostBack)
{
this.bindtogridview();
//SqlConnection strcon = DB.createConnection();
//strcon.Open();
//SqlCommand cmd = new SqlCommand("select * from client ", strcon);
//SqlDataReader sdr = cmd.ExecuteReader();
//this.ddlgoodclient.DataSource = sdr;
//this.ddlgoodclient.DataValueField = "客户编号";
//this.ddlgoodclient.DataTextField = "客户名称";
//this.ddlgoodclient.DataBind();
}
}
//protected void Button1_Click(object sender, EventArgs e)
//{
// //string txtgoodsnum = this.txtgoodsnum .Text.ToString();
// string txtgoodsname = this.txtgoodsname.Text.ToString();
// string txtgoodsunit = this.txtgoodsunit.Text.ToString();
// string txtgoodsspecs = this.txtgoodsspecs.Text.ToString();
// string txtgoodsprice = this.txtgoodsprice.Text.ToString();
// string txtgoodsnumber = this.txtgoodsnumber.Text.ToString();
// string ddlgoodclient = this.ddlgoodclient.Text.ToString();
// //string Remark = this.Remark.Text.ToString();
// //string Username = Convert.ToString(Session["username"]);
// //string AddTime = Convert.ToString(DateTime.Now);
// SqlConnection strcon = DB.createConnection();
// //new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
// strcon.Open();
// SqlCommand scd = new SqlCommand("update stock set 商品名称='" + txtgoodsname + "',单位='" + txtgoodsunit + "' ,规格型号='" + txtgoodsspecs + "',单价='" + txtgoodsprice + "',数量='" + txtgoodsnumber + "', 供货商='" + ddlgoodclient + "'where 商品编号='"+txtgoodsnum+"'", strcon);
// scd.ExecuteNonQuery();
// strcon.Close();
// Response.Write("<script language=javascript>alert('您已经成功修改该商品!');location='altergoods.aspx'</script>");
//}
private void bindtogridview()
{
SqlConnection con = DB.createConnection();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand("select * from stock", con);
DataSet ds = new DataSet();
sda.Fill(ds, "stock");
this.GridView1.DataKeyNames = new string[] { "商品编号" };
this.GridView1.DataSource = ds.Tables["stock"];
this.GridView1.DataBind();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -