怎么利用存储过程更改textbox的数据然后在提交到数据库?  

解决方案 »

  1.   

    CREATE procedure pro_BindData
    @page_size int 
    as
    Exec('select top '+@page_size+' * from ShopCompany where flat=''推荐会员''')        public static void ProBinding(SqlConnection myConn,SqlCommand myCommand,SqlDataAdapter ada_bind,DataTable dt_bind,System.Web.UI.WebControls.DataGrid dg1,System.Web.UI.WebControls.Textbox tb)
            {
            // 指定要执行的命令为存储过程
            myCommand.CommandType = CommandType.StoredProcedure;
            // 增加输入参数并赋值
            myCommand.Parameters.Add("@page_size", SqlDbType.Int, 4);
            myCommand.Parameters["@page_size"].Value = tb.Value;
            myCommand.Parameters["@page_size"].Direction = ParameterDirection.Input;
              // 创建 DataAdapter 对象填充数据
             ada_bind = new SqlDataAdapter(myCommand);
            ada_bind.Fill(dt_bind);        // 将返回的数据和 DataGrid 绑定显示
            dg1.DataSource = dt_bind;
            dg1.DataBind();
            }