title: Cannot insert NULL value into SQL table column which is defined as auto increment
body: <p>I have a table employee where id is defined as auto increment</p>
  
  <p>schema:</p>
  
  <pre><code>employee(id, name, company, salary, age)
  
  insert into employee(name, company, salary, age) 
  values('John', 'ABC', 90000, 30);
  </code></pre>
  
  <p>This works. However, when doing the same thing via asp.net </p>
  
  <pre><code>SqlConnection xconn = new SqlConnection();
  xconn.ConnectionString = @"";  //connection details go here
  xconn.Open()
  
  String query = "insert into employee(name, company, salary, age) values(@name, @company, @salary, @age)";
  SqlCommand ycmd = new SqlCommand(query, xconn);
  ycmd.Parameters.Add("@name", name);
  ycmd.Parameters.Add("@company", company);
  ycmd.Parameters.Add("@salary", salary);
  ycmd.Parameters.Add("@age", age);
  ycmd.ExecuteNonQuery();
  </code></pre>
  
  <p>Here <code>name, company, salary, age</code> contain the respective values. </p>
  
  <p>I get an exception</p>
  
  <blockquote>
    <p>Cannot insert value NULL into column ID, column does not allow nulls</p>
  </blockquote>