I'm new to silverlight and therefore data access in silverlight so bear with me. I have an ADO.Net entity data model referencing a sql server 2008 database. The table causing problems is called transaction. The transaction table has a non-nullable field "MerchantChain". This table is populated by another program that inserts empty strings into the merchantchain field when a merchant chain is not supplied. So in my silverlight app I load a grid with transactions based on criteria supplied by the user. The grid is for display only, but I need to be able to update the status of a transaction after a user views it. So I set the transaction.status field and attempt a submitchanges. Before submitchanges, the transaction.HasValidationErrors is false. As soon as the submitchanges is executed (in the debugger) the HasValidationErrors is true and the submit throws an unhandled exception. The ValidationError is that the merchantchain field is required. Well, its an empty string - its not null. No idea what to do. This is visual studio 2010, silverlight 4, vb.net.
1
votes
Ouch my sympath. A design which makes a field to non-nullable but considers an empty string in such a field as an acceptable and expected value is asking for trouble.
- AnthonyWJones
@AnthonyWJones blank strings are not the same as nullable strings. Consider the query: SELECT * WHERE SomeString != 'Foo', if SomeString is not nullable, the result set will contain the blank string values, if it's nullable, those null rows will be missing. Blank string is 'a string of length 0', NULL is 'no string, no length, no nothing'
- Sprague
@Eugarps: Umm.. ok thanks for that.
- AnthonyWJones