Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

How to save NULL to Sql DB when dataset non primary column bound to TextBox

$
0
0
I was trying implement behavior where when a user backspaced,cut or deleted selected text to an empty string in a bound Textbox to a dataTable column, the underlying DB value would be set to NULL, but I keep getting concurrency problems trying to do this with my own sql command inside a TextChanged handler when later the DataAdapter designer generated Update is called for a BindSource PositionChanged event handler. The way SSMS edit all rows exhibits a kind of the behavior in that typing "NULL" stores a NULL in the DB. The best I have managed to do is get a DATALENGTH(<column>) = 0 when the textbox string is empy and that lets me update the DB on FormClosing to NULL. The application is single user. Also, I was would like to use  the designer generated  Update Command. What would be a way to do such?

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>