如何动态设置参数值 [英] How to set paramter value dynamically

查看:94
本文介绍了如何动态设置参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想从后面的代码中为存储过程设置值.我知道如何分别设置参数值.但是在这种情况下,我既不知道存储过程的参数数量,也不知道参数名称.我只知道存储过程.我该如何实现?
请帮我.在此先感谢

Hi,
I want to set value to stored procedure from code behind. I know how to set parameter value individually. But in this case, i am not aware of number of parameters of stored procedure also not aware of name of parameters. I am aware of stored procedure only. How can i acheive this?
please help me. thanks in advance

推荐答案

首先,您必须获取参数列表.一些方法显示在例如http://stackoverflow.com/questions/3038364/通过-c-sharp-or-sql获取存储过程参数 [
First you have to get a list of the parameters. Some methods are shown in e.g. http://stackoverflow.com/questions/3038364/get-stored-procedure-parameters-by-either-c-sharp-or-sql[^]
Then you can iterate thru the list and supply the appropriate values.


这篇关于如何动态设置参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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