mohammad qasim

mohammad qasim

  • NA
  • 408
  • 0

How to call store procedure by sqldatasource Programmatically to bind gridview

Dec 7 2011 1:41 PM
how can we execute store procedure by using sqldatasource
Programmatically??
 

I want to bind it with gridview
i am using like this
 


 Collapse | Copy Code
sqldsSiteList.SelectCommandType = SqlDataSourceCommandType.StoredProcedure sqldsSiteList.SelectCommand = "Stp_RmsAdmin_GetsitesBycustomization" 

 Collapse | Copy Code
sqldsSiteList.SelectParameters.Add("@CustomerID", TypeCode.Int32, ddlCustomer.SelectedValue) sqldsSiteList.SelectParameters(0).Direction = ParameterDirection.Input 

 Collapse | Copy Code
sqldsSiteList.SelectParameters.Add("@PageIndex", TypeCode.Int32, "1") sqldsSiteList.SelectParameters(1).Direction = ParameterDirection.Input   GridView1.DataBind()  

when i bind it to grid it gives me error

 Collapse | Copy Code
"Procedure or Function 'Stp_RmsAdmin_GetsitesBycustomization' expects parameter '@CustomerID', which was not supplied."

Answers (2)