为什么我的存储过程不能从我的代码中识别我的参数? [英] Why isn't my stored procedure recognizing my parameter from my code?

查看:80
本文介绍了为什么我的存储过程不能从我的代码中识别我的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.Net代码:

My .Net code:

展开 | 选择 | Wrap | 行号

推荐答案

问题是,你的参数没有''提供了一个值。

如果您不想使用 AddWithValue ,您可以执行以下操作:

The problem is, your parameter doesn''t have a value supplied.
If you don''t want to use AddWithValue, you can do the follwing:

展开 | 选择 | Wrap | 行号


但我的值是数据集中数据列的数据。当我做.Value = dataColumn时我仍然得到相同的错误。

顺便说一下,当它不是一个存储过程时,同样的代码工作,但我的代码中的SQL。这有什么意义?
But my value is the data from the datacolumn in my dataset. When I do ".Value=dataColumn" I still get the same error.
By the way, this same code worked when it was not a stored procedure, but SQL in my code. How does that make sense?


哦,我明白了。我从未将SqlParameters与源列一起使用。

如果为@Carrier设置SourceVersion属性,就像在其他参数上设置的那样? (comm.Parameters [" @ Carrier"]。SourceVersion = DataRowVersion.Original;)

调试时, dataSet 是否有一个名为值 doCarrier.ColumnName
Oh, I see. I have never used SqlParameters with source-columns.
What if you set the SourceVersion-property for @Carrier like you did on the other parameter? (comm.Parameters["@Carrier"].SourceVersion = DataRowVersion.Original;)

When you debug, does dataSet have a column named like the value of doCarrier.ColumnName?


这篇关于为什么我的存储过程不能从我的代码中识别我的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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