ikrami sami

ikrami sami

  • 1.5k
  • 193
  • 22.6k

GridView with stored procedure

Jun 18 2022 4:10 PM

I have stored procedure to fill Gridview:

        SqlDataSource SqlDataSource1 = new SqlDataSource();
        SqlDataSource1.ID = "SqlDataSource1";
        this.Page.Controls.Add(SqlDataSource1);
        SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["XYZ"].ConnectionString;
     
        SqlDataSource1.SelectParameters.Add("@OrganizationID", "1");
        
        SqlDataSource1.SelectCommand = "Execute JVonTheFLY";
        

 DataView dvProducts = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
 DataTable dtProducts = dvProducts.Table;
 BoundField boundField = null;

 

It is woking if i don't use parameters, but when i use patameter is not send to sql server procedure

"Procedure or function 'JVonTheFLY' expects parameter '@OrganizationID', which was not supplied."


Answers (1)