I'm working with several forms and so far I've figured that there really is no way to take an empty text field and insert it into a database as null.
for example if the text field is empty in:
<asp:TextBox id="tb0" runat="server"></asp:TextBox>
<asp:TextBox id="tb1" runat="server"></asp:TextBox>
<asp:TextBox id="tb2" runat="server"></asp:TextBox>
But filled in the textboxes surrounding it
Is there any way for the query to, when run, look like this:
INSERT INTO table_name VALUES ('test0', null, 'test2')
Instead of having to loop through and changing the values to whitespace? The whitespace is fine when they are varchar fields but for ints/dates it is very annoying
Here is a part of one of my inserts
"INSERT INTO Customer VALUES(" + custID + " , @mastName, @custName, @addrLn1, @addrLn2, @cCity, @cState, @cZip, @cZip4, @cCountry, @cusSince, @renewalDate)"
BTW custID is not a parameter because it is a float and when I set it as a parameter the value gets messed up (e.g 105.05 will turn into 105.0498..)