c# - save Datatable values as empty string instead of null -


I am using a SqlDataAdapter to save some values ​​from a table in the database:

  Private binding source bindingSource1 = new binding resource (); Private SqlDataAdapter Data Adapter = New SqlDataAdapter (); ... Data Adapter. Update (datatable) binding source 1. datasource);   

But it is saving empty values ​​in the database nullally. Is it anyway that they want to save it as an empty wire instead? After some research, the manual is being done manually, so I have written a method that does this.

  Remove public static datatable extract (datatelle dt) {for (int a = 0; a & lt; dt.rows.Count; a ++) {for (int i = 0; i & Lt; dt column number; i ++) {if (dt.Rows [a] [i] == DBNull.Value) {dt.owsows [one] [i] = ""; }}} Return DT; }   

and some related links



Comments