我有gridview,我在后端使用存储过程.问题是我没有使用任何文本框或仅标签gridview.
当我运行我的代码时,它显示一个编译错误,spproduct1期望参数@id,这是预期不提供的.你能解决这个错误吗?
public partial class WebForm1 : System.Web.UI.Page
{
string _strsql = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
string cs = ("Data Source=172.16.6.173;Initial Catalog=servion_hari;User ID=sa;Password=Servion@123");
_strsql = "select * from tblproduct where id=@id and Name=@Name and Description=@Description";
SqlConnection con = new SqlConnection(cs);
con.Open();
SqlDataAdapter da = new SqlDataAdapter("spgetproducts1", con);
SqlCommand cmd = new SqlCommand();
SqlParameter id = new SqlParameter("@id", SqlDbType.Int.ToString());
id.Value = GridView1.ToString();
da.SelectCommand.CommandType = CommandType.StoredProcedure;
con.Close();
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
} …Run Code Online (Sandbox Code Playgroud) 这个问题很简单,但在Yii2中我找不到解决方案.
鉴于生日字段,gridview如何按年度过滤?通常在索引gridview中.
我想要一个带有空格的变量名.我将此集合传递给gridview,我需要标题有一个空格而不是下划线
var registrationReport = (from r in BankMedEntity.Customers
select new {r.Id,Customer Type = r.CustomerType_Id });
Run Code Online (Sandbox Code Playgroud)
有关如何实现这一点的任何想法?
我需要将标题设为"客户类型"而不是"CustomerType_Id"