Home All Groups Group Topic Archive Search About

Is this a bug in the data adapter wizard?

Author
9 Oct 2006 9:28 PM
Alan Pretre
In VS 2003 when I use the Configure Data Adapter option in VS 2003 I get the
size parameter to the SqlParameter set to the correct size for a varchar,
for example,

....
new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
System.Data.SqlDbType.VarChar, 256, "SWA_SO_TYPE"),



whereas in VS 2005, the wizard gives me (0 instead of 256),

....
new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
System.Data.SqlDbType.VarChar, 0, "SWA_SO_TYPE"),


This is showing up now as a bug in production code because I get the
exception:


System.Data.SqlClient.SqlException: String or binary data would be
truncated.
The statement has been terminated.
Source: .Net SqlClient Data Provider
HResult: -2146232060 (0x80131904)
Errors Collection:
-------------------------------------
   Class: 16
   LineNumber: 1
   Message: String or binary data would be truncated.
   Number: 8152
   Server: MACC2K3012
   Source: .Net SqlClient Data Provider
   State: 9
-------------------------------------
   Class: 0
   LineNumber: 1
   Message: The statement has been terminated.
   Number: 3621
   Server: MACC2K3012
   Source: .Net SqlClient Data Provider
   State: 0
ErrorCode: -2146232060


Can anyone help me?  Thanks.


-- Alan

Author
10 Oct 2006 1:31 PM
Alan Pretre
Does anyone have any suggestions for this issue?

-- Alan


Show quote
"Alan Pretre" <no@spam> wrote in message
news:e17kUn%236GHA.4304@TK2MSFTNGP03.phx.gbl...
> In VS 2003 when I use the Configure Data Adapter option in VS 2003 I get
> the size parameter to the SqlParameter set to the correct size for a
> varchar, for example,
>
> ...
> new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
> System.Data.SqlDbType.VarChar, 256, "SWA_SO_TYPE"),
>
>
>
> whereas in VS 2005, the wizard gives me (0 instead of 256),
>
> ...
> new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
> System.Data.SqlDbType.VarChar, 0, "SWA_SO_TYPE"),
>
>
> This is showing up now as a bug in production code because I get the
> exception:
>
>
> System.Data.SqlClient.SqlException: String or binary data would be
> truncated.
> The statement has been terminated.
> Source: .Net SqlClient Data Provider
> HResult: -2146232060 (0x80131904)
> Errors Collection:
> -------------------------------------
>   Class: 16
>   LineNumber: 1
>   Message: String or binary data would be truncated.
>   Number: 8152
>   Server: MACC2K3012
>   Source: .Net SqlClient Data Provider
>   State: 9
> -------------------------------------
>   Class: 0
>   LineNumber: 1
>   Message: The statement has been terminated.
>   Number: 3621
>   Server: MACC2K3012
>   Source: .Net SqlClient Data Provider
>   State: 0
> ErrorCode: -2146232060
>
>
> Can anyone help me?  Thanks.
>
>
> -- Alan
>
>
Author
10 Oct 2006 5:03 PM
Jeff Dillon
Change the code manually after you run the wizard??

Show quote
"Alan Pretre" <no@spam> wrote in message
news:%23Iao1BH7GHA.4428@TK2MSFTNGP02.phx.gbl...
> Does anyone have any suggestions for this issue?
>
> -- Alan
>
>
> "Alan Pretre" <no@spam> wrote in message
> news:e17kUn%236GHA.4304@TK2MSFTNGP03.phx.gbl...
>> In VS 2003 when I use the Configure Data Adapter option in VS 2003 I get
>> the size parameter to the SqlParameter set to the correct size for a
>> varchar, for example,
>>
>> ...
>> new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
>> System.Data.SqlDbType.VarChar, 256, "SWA_SO_TYPE"),
>>
>>
>>
>> whereas in VS 2005, the wizard gives me (0 instead of 256),
>>
>> ...
>> new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
>> System.Data.SqlDbType.VarChar, 0, "SWA_SO_TYPE"),
>>
>>
>> This is showing up now as a bug in production code because I get the
>> exception:
>>
>>
>> System.Data.SqlClient.SqlException: String or binary data would be
>> truncated.
>> The statement has been terminated.
>> Source: .Net SqlClient Data Provider
>> HResult: -2146232060 (0x80131904)
>> Errors Collection:
>> -------------------------------------
>>   Class: 16
>>   LineNumber: 1
>>   Message: String or binary data would be truncated.
>>   Number: 8152
>>   Server: MACC2K3012
>>   Source: .Net SqlClient Data Provider
>>   State: 9
>> -------------------------------------
>>   Class: 0
>>   LineNumber: 1
>>   Message: The statement has been terminated.
>>   Number: 3621
>>   Server: MACC2K3012
>>   Source: .Net SqlClient Data Provider
>>   State: 0
>> ErrorCode: -2146232060
>>
>>
>> Can anyone help me?  Thanks.
>>
>>
>> -- Alan
>>
>>
>
>
Author
10 Oct 2006 7:38 PM
Alan Pretre
"Jeff Dillon" <jef***@nowhere.com> wrote in message
news:Oau853I7GHA.2248@TK2MSFTNGP04.phx.gbl...
> Change the code manually after you run the wizard??

Yes of course, but that kind of defeats the purpose of the wizard, doesn't
it?

My concern is that this is user error (mine) and what I may be doing wrong,
or if this is a problem with the wizard.  What I did in VS 2005 is the same
as I did in VS 2003 and I get different results.

-- Alan
Author
10 Oct 2006 10:37 PM
Jeff Dillon
Fix it and move on? Am I missing something? Perhaps it's a bug in the
Wizard? Duely noted...

Show quote
"Alan Pretre" <no@spam> wrote in message
news:egQMzOK7GHA.1252@TK2MSFTNGP04.phx.gbl...
> "Jeff Dillon" <jef***@nowhere.com> wrote in message
> news:Oau853I7GHA.2248@TK2MSFTNGP04.phx.gbl...
>> Change the code manually after you run the wizard??
>
> Yes of course, but that kind of defeats the purpose of the wizard, doesn't
> it?
>
> My concern is that this is user error (mine) and what I may be doing
> wrong, or if this is a problem with the wizard.  What I did in VS 2005 is
> the same as I did in VS 2003 and I get different results.
>
> -- Alan
>
>
Author
15 Oct 2006 5:50 PM
Earl
I've created a bunch of parameters with the 2005 DACW and it does the same
thing, but I've had no errors running the code with 0 as a the length
setting. I suspect that 0 means "up to maximum length" but I have yet to
find out.

Show quote
"Alan Pretre" <no@spam> wrote in message
news:e17kUn%236GHA.4304@TK2MSFTNGP03.phx.gbl...
> In VS 2003 when I use the Configure Data Adapter option in VS 2003 I get
> the size parameter to the SqlParameter set to the correct size for a
> varchar, for example,
>
> ...
> new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
> System.Data.SqlDbType.VarChar, 256, "SWA_SO_TYPE"),
>
>
>
> whereas in VS 2005, the wizard gives me (0 instead of 256),
>
> ...
> new System.Data.SqlClient.SqlParameter("@SWA_SO_TYPE",
> System.Data.SqlDbType.VarChar, 0, "SWA_SO_TYPE"),
>
>
> This is showing up now as a bug in production code because I get the
> exception:
>
>
> System.Data.SqlClient.SqlException: String or binary data would be
> truncated.
> The statement has been terminated.
> Source: .Net SqlClient Data Provider
> HResult: -2146232060 (0x80131904)
> Errors Collection:
> -------------------------------------
>   Class: 16
>   LineNumber: 1
>   Message: String or binary data would be truncated.
>   Number: 8152
>   Server: MACC2K3012
>   Source: .Net SqlClient Data Provider
>   State: 9
> -------------------------------------
>   Class: 0
>   LineNumber: 1
>   Message: The statement has been terminated.
>   Number: 3621
>   Server: MACC2K3012
>   Source: .Net SqlClient Data Provider
>   State: 0
> ErrorCode: -2146232060
>
>
> Can anyone help me?  Thanks.
>
>
> -- Alan
>
>

AddThis Social Bookmark Button