title: How to insert a null-value to the database in C# without using parameters?
body: <p>Using SQL parameters, I could insert a <code>NULL</code> value to the database using this sort of C# code:</p>
  
  <pre><code>string query = "INSERT INTO table_name (column_name) VALUES (@value)";
  using (SqlConnection connection = new SqlConnection(/* connection info */))
  {
      using (SqlCommand command = new SqlCommand(query, connection))
      {
          command.Parameters.Add("@value", DBNull.Value);
          command.ExecuteNonQuery();
      }
  }
  </code></pre>
  
  <p>Not using parameters is usually considered to be bad practice, because of SQL-Injection and some other reasons. But, I am curious to know if there is a way to do so without using them. Something like this:</p>
  
  <pre><code>var nullValue = DBNull.value;
  string query = "INSERT INTO table_name (column_name) VALUES (" + nullValue + ")";
  </code></pre>
  
  <p>or even:</p>
  
  <pre><code>string query = "INSERT INTO table_name (column_name) VALUES (\\NULL\\)"; 
  </code></pre>
  
  <p>or whatever. Thanks.</p>