Hi. I have a gridview control on a web form (asp.net 2.0) that's bound to a
objectDataSource. The objectdatasource which is bound to a class I've
written in the DAL to read and update the database. The grid contains three
columns - an ID (GUID), a name (string) and a rowversion (timestamp), and
the data is passed to/from the page in an instance of a data entity object.
When I open the page the grid loads properly, but if I attempt to edit a
row, it bombs when I click on the UPDATE link with an error message of:
Cannot convert value of parameter 'rowversion' from 'System.String' to
'System.Byte[]' . The column rowversion is stored in the database as
timestamp, and in my business entity as a byte array. My guess is that when
it's passed into the gridview it's converted to a string, but when passing
it back to the DAL, the concersion from String to byte[] isn't working. The
bug is taking place after the rowupdating event, but before the update code
in the DAL gets called.
Any idea what''s going wrong?
Ben