为什么VS2010生成的所有SqlParameters的大小都设置为0? [英] why the size of all SqlParameters generated by VS2010 are set to 0?

查看:18
本文介绍了为什么VS2010生成的所有SqlParameters的大小都设置为0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么VS2010生成的所有SqlParameters的大小都设置为0,而当我查看数据集时,所有列都设置为不同的大小,但是当我从sqldataadapter读取时,它们都设置为0.不是吗将来会提出一些其他问题吗?我的意思是,我有很多带有 NVarChar 类型的 sqlparameter,它们是由 VS2010 生成的,大小为 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? I mean, I have many sqlparameter with NVarChar types that they are generated by VS2010 and the size is 0!!! Any other information in this area will be appreciated. Cheers!

推荐答案

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."

我的猜测是没有明确设置大小;因此它显示为 Int32 的默认值,它为零,因此大小将从值的实际大小中推断出来.

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.

(换言之:它们没有设置为 0,它们根本没有设置)

(To rephrase: they're not set to 0, they're just not set at all)

这篇关于为什么VS2010生成的所有SqlParameters的大小都设置为0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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