searchgoods.ascx.cs

来自「用vs2005和sql2000实现的小型超市管理系统」· CS 代码 · 共 57 行

CS
57
字号
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_searchgoods : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
        //    this.bindtogridview();
        //}
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string 商品编号 = this.txtserachid.Text.ToString();;
        SqlConnection con = DB.createConnection();
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from addgoods where 商品编号='" + 商品编号 + "'", con);
        cmd.ExecuteNonQuery();
        con.Close();

        //string sqlstr = "select * from addgoods where  商品编号  like '%" + this.txtserachid.Text + "'";
        //SqlCommand.SelectCommand = sqlstr;
        //this.GridView1.DataBind(); 

    }
   // private void bindtogridview();
   //{

   //     string 商品编号 = this.txtserachid.Text.ToString();
   //     SqlConnection con = DB.createConnection();
   //     SqlDataAdapter sda = new SqlDataAdapter();
   //     sda.SelectCommand = new SqlCommand("select * from addgoods ", con);
   //     DataSet ds = new DataSet();
   //     sda.Fill(ds, "addgoods");
   //     this.GridView1.DataKeyNames = new string[] { "商品编号" };
   //     this.GridView1.DataSource = ds.Tables["addgoods"];
   //     this.GridView1.DataBind();
   // }
    //protected void txtserachid_TextChanged(object sender, EventArgs e)
    //{

    //}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?