使用从c#中具有不同字段数的动态表中选择的存储过程 [英] use stored procedure that select from dynamic table with different number of fields in c#

查看:62
本文介绍了使用从c#中具有不同字段数的动态表中选择的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用存储过程来选择c#中不同数量的字段
我不知道字段是多少或什么

我正在使用c#

i have to use stored procedure that select different number of fields in c#
i don''t know how much are the fields or what are

i am working in c#

推荐答案



如果您可以通过示例来说明问题,但仍然无法解决问题,我将无法理解您要做什么,

您可以使用逗号分隔来传递字段名称,并且可以在存储过程中直接使用.

您可以使用以下示例.

Hi,

I am not able to understand what you want to do if you can then explain your problem with a example and still as your question in am giving answer,

You can pass the name of fields using comma separation and in stored procedure you can directly use.

you can use like below example.

Create procedure proc_DynamicFields(@items varchar(max))
as
Begin
declare @sql varchar(max)

set @sql = 'select ' + @items + ' from tbl_TableName'

Exec(@sql)
End



您可以在c#add fill Data Adapter中调用上述Procedure,然后在Data Adapter中获取特定表的动态字段.

希望能成功
谢谢



You can call above Procedure in c# add fill Data Adapter after that you can get the dynamic fields of particular table in Data Adapter.

Hope, it will Work
Thanks


您好,

请问您想问的是什么.请对此事稍作解释,否则一个人将如何帮助您.

谢谢
Tapan kumar
Hi,

Will you please clarify what your are trying to ask. Please explain the thing a bit otherwise how can one be able to help you out.

Thanks
Tapan kumar


这篇关于使用从c#中具有不同字段数的动态表中选择的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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