title: Column does not allow nulls
body: <p>Please have a look at my code below and tell me where i am going wrong. </p>
  
  <pre><code>case "particulars.aspx":
     dt = JobCardManager.GetParticularsByJobId(id);
     hidJobId.Value = id.ToString();
     if (dt != null &amp;&amp; dt.Rows.Count &gt; 0)
     {
        gvParticulars.DataSource = dt;
        gvParticulars.DataBind();
     }
     else
     {
        **dt.Rows.Add(dt.NewRow());**
        gvParticulars.DataSource = dt;
        gvParticulars.DataBind();
  
        int TotalColumns = gvParticulars.Rows[0].Cells.Count;
        gvParticulars.Rows[0].Cells.Clear();
        gvParticulars.Rows[0].Cells.Add(new TableCell());
        gvParticulars.Rows[0].Cells[0].ColumnSpan = TotalColumns;
        gvParticulars.Rows[0].Cells[0].Text = "No Record Found";
     }
  
     ddlJobs.Enabled = false;
     gvParticulars.ShowFooter = true;
     break;
  </code></pre>
  
  <p>What I want to achieve is that in case when the <code>dt</code> don't have any rows, I need to display a new row in the footer, controls are already added in footer. My insert update and add new process all are carried out from grid itself. </p>
  
  <p>So in case if my datatable comes null, then at the starred line, I am getting the error, "Column does not allow null". Where in database all columns have Allow Null checkboxes are checked. Please help.</p>
  
  <p><strong>[Update]</strong></p>
  
  <p>I am not retriving primary key in the query. Only the editable parts of the table.</p>