如何以编程方式通过sqldatasource调用存储过程 [英] how to call store procedure by sqldatasource Programmatically

查看:212
本文介绍了如何以编程方式通过sqldatasource调用存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用sqldatasource执行存储过程
以编程方式?

我正在这样使用


how can we execute store procedure by using sqldatasource
Programmatically??

i am using like this


sqldsSiteList.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
       sqldsSiteList.SelectCommand = "Stp_RmsAdmin_GetsitesBycustomization"







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







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

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

推荐答案


以编程方式SqlDatASource [

这篇关于如何以编程方式通过sqldatasource调用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆