2
Answers

How to call store procedure by sqldatasource Programmatically to bind gridview

mohammad qasim

mohammad qasim

12y
5.5k
1
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)