Excel Upload Truncating Large String Values

liunx

Guest
I built an Excel spreadsheet upload page which works perfectly except for one issue. The spreadsheet has a various columns and the last column is called Comments. This is where the user can type up to 1,000 characters.

The first few rows of the spreadsheet do not have comments (the user didn't enter anything in for thos rows) and the largest comment is 769 characters and that sits at row 20 in the spreadsheet.

When the spreadsheet is uploaded it truncates the value any comment to only 255 characters maximum.

If I move this 20th row to the first row and try and upload the Excel file.. the upload works perfectly... The full 769 characters gets uploaded.

I looked into this a bit more and interrogated the value in a dataset table (I'm using vb.net) and found that the data in the dataset was only 255 characters (prior to me moving it up in the spreadsheet)...

Does anyone know if this is an Excel issue or a .net issue? Also, is there anything I can do to fix this. Here is a piece of the code that I wrote to interrogate the comments value:

Dim parmComments As SqlParameter = New SqlParameter("@comments", SqlDbType.VarChar, 1000)
If Len(drowItem.Item("Comments").ToString()) = 255 Then
parmComments.Value = "Value is 255"
Else
parmComments.Value = drowItem.Item("Comments")
End If
cmdInsert.Parameters.Add(parmComments)
 
Back
Top