简体   繁体   English

为什么将VS2010生成的所有SqlParameters的大小都设置为0?

[英]why the size of all SqlParameters generated by VS2010 are set to 0?

why the size of all SqlParameters generated by VS2010 are set to 0, while when I look in the dataset all the columns are set to different sizes but when I read it from sqldataadapter they are all set to 0. Isn't it going to make some other issues in future? 为什么将由VS2010生成的所有SqlParameters的大小都设置为0,而当我在数据集中查看时,所有列都设置为不同大小,但是当我从sqldataadapter中读取它们时,它们都都设置为0。将来还有其他问题吗? I mean, I have many sqlparameter with NVarChar types that they are generated by VS2010 and the size is 0!!! 我的意思是,我有很多带有NVarChar类型的sqlparameter,它们是由VS2010生成的,大小为0! Any other information in this area will be appreciated. 在这个领域的任何其他信息将不胜感激。 Cheers! 干杯!

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter.size.aspx http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter.size.aspx

"If not explicitly set, the size is inferred from the actual size of the specified parameter value." “如果未显式设置,则从指定参数值的实际大小推断大小。”

My guess is that the size has not been explicitly set; 我的猜测是尚未明确设置大小; thus it appears as the default for an Int32, which is zero, thus the size will be inferred from the actual size of the value. 因此,它似乎是Int32的默认值,该默认值为零,因此将从值的实际大小推断出大小。

(To rephrase: they're not set to 0, they're just not set at all) (换句话说:它们没有设置为0,根本就没有设置)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM