Change NullValue behavior for generated Typed Datasets in Visual Studio 2005.

Update: I found that the issue with similar solution is already discussed in “Setting NullValue property for typed dataset”  blog

In generated Typed Datasets attempt to access field with DBNull value by default throw an exception. It is usually  not convinient, and I prefer to change nullValue annotation to _null,  as it was suggested here

However I didn't find a way to change the default(Anyone knows???).

I have to open each column in desigher and change the  nullValue to _null.

Alternatively I have to open .XSD file in XML editor (rigth mouse click,“open with...“,”XML editor” - no XML Vew tab in VS 2005 as it was in VS 2003) and insert ="_null" to each column.

msprop:nullValue

You cah try global replace

type="xs:string"    to

msprop:nullValue="_null" type="xs:string" 

Note, that you can NOT assign _null to simple types, like int or bool.


It is not very convinient process.

Related request in MS Connect:Allow Null Values to be returned from strongly typed datasets .

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Thursday, March 02, 2006 9:23 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910