string or binary data would be truncated

  • Thread starter Thread starter Usarian Skiff
  • Start date Start date
U

Usarian Skiff

Working with vb.net (1.1) and SQL Server 2000 here.

I have textboxes and datetime pickers bound to a parent a child table.

When I try to execute a da.update, I get a SQL server error "String or
Binary data would be truncated"

I have looked at all my columns, and haven't found any obvious size issues
for the data that I'm dealing with.

I am using text, nchar(255), and smalldatetime data types.

Is there a way to narrow down which column(s) are causing the issue?
How many characters does the text datatype expect?
 
The way I usually do it is just change my sql statement temporarily to
eliminate the suspects one by one. The 'best' way though is to use Profiler
and see what's actually being sent to the server with your parameters - that
is usually the best way to see the problem clearly. Also make sure the the
column lengths that you're using accurately correspond to the parameter
values, if they do (ie, First_Name Varchar(50) and you set the paramater of
your proc or Sql Statement which corresponds to First_Name to
SqlDbType.Varchar, 50 - then it should be caught up front.

HTH,

Bill
 
Back
Top