visual studio 2010 - Change the default behaviour of NullValue in a DataSet -
i have used .net mysql connector import dataset of mysql schema visual studio.
visual studio has generated *.xsd
file me visual representation of tables, , fields within tables in schema.
i running queries against these tables using linq.
by default, nullvalue
property of every field in every table set (throw exception). means in practice if apply criteria column contains null values in query, exception thrown when try enumerate through results shown below:
the easy way fix change nullvalue property of particular column either (null)
or (empty)
, have lot of columns in lot of tables , changing of these 1 @ time pain. can't use shift key select columns either, (null)
, (empty)
values apply reference types , nullable value types, if, example, selection contains single integer, none of properties updated.
is there option in visual studio change default behaviour of nullvalue property on column in datatable across board?
thanks
- in solution explorer, right-click on .xsd file
- select "open with..."
- choose "xml (text) editor"
- find field you've set "(empty)" or whatever want "default" value , review of syntax of
msprop:nullvalue
suchmsprop:nullvalue="_empty"
- use text search-and-replace (ctrl+h default) modify rest of nullable field xml tags in file. 1 way find standard column tag , add it. example, find
msprop:generator_columnpropnameintable
, replacemsprop:nullvalue="_empty" msprop:generator_columnpropnameintable
- after done making replacements, ensure sure have 1 instance of
msprop:nullvalue
attribute per column or you'll have dataset syntax error - save file , close it
- double click on .xsd opens in xsd designer , save ensure have no syntax errors , designer.cs files updated.
Comments
Post a Comment