Re: SqlParameter with size=0 by Mary
Mary
Thu May 01 11:49:36 CDT 2008
The size for input parameters for string or binary data is inferred
from the parameter value at run time. So if you're creating the
parameter using a wizard, SqlParameter has no way of knowing the
actual size of the data. If you set the size manually, and the size is
smaller than the data at run time, then the data will be trunated. So
if you're getting the odd exception, you might be better off simply
omitting the size for string and binary data.
-Mary
On Thu, 1 May 2008 09:17:33 -0700, Aurin <Aurin@nospam.nospam> wrote:
>after further research I realize that this is how SqlDataAdapters are done in
>2005. At this point I have some that work. However, I have another one that
>returned a SqlException "String or binary data would be truncated. ". I
>resolved the problem by entering the data lengths into the SqlParameters. So
>now I assume that if size=0, the size will be obtained from the dbType and
>the length of the value. Is this true?