I have a formview which is connected to an MS SQL database. I have a couple of fields that sometimes have nothing in the data fields. I want formview to databind '' instead of Null back into the database on an update or insert. Is there a way to do this
or am I forced to store Null if their is nothing to store?
You can set BoundField.ConvertEmptyStringToNull Property to a false or true,which gets or sets a value indicating whether empty string values ("") are automatically converted to null values when the data field is updated in
the data source.
dgrumbli
Member
171 Points
76 Posts
storing nothing data with formview
Apr 30, 2012 03:54 AM|LINK
Hi,
I have a formview which is connected to an MS SQL database. I have a couple of fields that sometimes have nothing in the data fields. I want formview to databind '' instead of Null back into the database on an update or insert. Is there a way to do this or am I forced to store Null if their is nothing to store?
Thanks
Dan
nirman.doshi
Participant
1521 Points
783 Posts
Re: storing nothing data with formview
Apr 30, 2012 04:44 AM|LINK
You mean to say, you want to store empty string in the database rather than Null?
If so, then you can achieve it by handling them in "ItemUpdating", and "ItemInserting" of FormView
Software Developer
Vadodara, India
YunJiang
Participant
1124 Points
122 Posts
Re: storing nothing data with formview
May 04, 2012 03:15 PM|LINK
You can set BoundField.ConvertEmptyStringToNull Property to a false or true,which gets or sets a value indicating whether empty string values ("") are automatically converted to null values when the data field is updated in the data source.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.convertemptystringtonull.aspx