显示存储过程的参数值列表

时间:2022-10-16 10:05:54

calling a stored procedure as

将存储过程称为

int pageNumber = 1;
int pageSize = 4;
SubSonic.StoredProcedure sp = SPs.UspListPlants(pageNumber, pageSize);
string result = sp.GetReader();

The sp work fine, but trying

sp很好,但是很努力

foreach (SubSonic.StoredProcedure.Parameter param in sp.Parameters)
    {
          sb.Append("'" + param.Name + "' = ");
    }

I have zero parameters count.

我有零参数计数。

How to print on log parameter's values of sql stmt executed as :

如何在sql stmt的log参数值上打印执行:

EXEC UspListPlants(pageNumber = 1, pageSize = 4)

Thank's, regards

Claudio

1 个解决方案

#1


Does sp.Parameters actually implement IEnumerable? If not then foreach won't work and you need to call something like a GetEnumerator method on sp.Parameters to be able to iterate over it.

sp.Parameters实际上是否实现了IEnumerable?如果没有,则foreach将无法工作,您需要在sp.Parameters上调用类似GetEnumerator方法的东西才能迭代它。

#1


Does sp.Parameters actually implement IEnumerable? If not then foreach won't work and you need to call something like a GetEnumerator method on sp.Parameters to be able to iterate over it.

sp.Parameters实际上是否实现了IEnumerable?如果没有,则foreach将无法工作,您需要在sp.Parameters上调用类似GetEnumerator方法的东西才能迭代它。