Is this a bug in the data adapter wizard?

  • Thread starter Thread starter Alan Pretre
  • Start date Start date
A

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
 
Jeff Dillon said:
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
 
Fix it and move on? Am I missing something? Perhaps it's a bug in the
Wizard? Duely noted...
 
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.
 
Back
Top