#if directives in backend .cs files are handled by the C# compiler, not ASP.Net.
Set your project to the Release configuration so that that symbol is not defined when compiling the DLL in VS.

ASP.net Website want debug to == false on IIS
I'm working on a page where a user can create new records, but not all values are required. When creating the SqlCommand with potentially null values, I'm wondering what's the best way, from a code readability standpoint, to check if there's any valid/useful information in a given field. If there is, add that information to the command, if there's isn't, add a DBNull. 

Let's say we have a textbox, Address, which is non-compulsory (comm is the SqlCommand):

if(String.IsNullOrEmpty(Address.Text))
{
    comm.Parameters.AddWithValue("@Address", (Object) DBNull.Value)
}
else
{
    comm.Parameters.AddWithValue("@Address", (Object) Address.Text);
}


That seems like a lot of unnecessary typing. But trying to get clever and condense it into a single statement:            

comm.Parameters.AddWithValue("@Address",
     String.IsNullOrWhiteSpace(Address.Text) ?
     (Object) DBNull.Value :
     (Object) Address.Text
     );


That seems a little too condensed, harder to parse and understand. Not too difficult to figure out, but (at least to me), also not immediately apparent what's going on. So a trade-off:

Object addressParam = 
    String.IsNullOrEmpty(Address.Text) ?
    (Object) DBNull.Value :
    (Object) Address.Text;

 comm.Parameters.AddWithValue("@Address", addressParam);


(Or the above in a if/else block).
Another option that just occurred as I wrote this question:

Object addressParam = (Object) DBNull.Value;
if(!String.IsNullOrWhiteSpace(Address.Text))
{
     addressParam = (Object) Address.Text;
}


Are any of these methods prefered? I am going about this completely the wrong way? Am I just way over-thinking this? It's the latter, isn't it?
