title: I encounter this NoNullAllowedException when I try to add a new row to my data table in Visual Studio 2013 for Desktop
body: <p>Can someone help me with this</p>
  
  <p>An unhandled exception of type 'System.Data.NoNullAllowedException' occurred in System.Data.dll  Additional information: Column 'TrainingSessionIndex' does not allow nulls.</p>
  
  <p>I get this at   'Add a new row to the Operator table.
                  <code>rw = TestdbDataSet1.Tables(0).Rows.Add()</code></p>
  
  <p>Here is the code:</p>
  
  <pre><code>Public Class Form1
      Dim da As OleDb.OleDbDataAdapter
      Dim ds As TestdbDataSet
      Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          'Fill retrieves rows from the data source by using the SELECT statement
          Using con As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Infane\Documents\Testdb.accdb")
              Using da = New OleDb.OleDbDataAdapter("SELECT * FROM OperatorDb", con)
                  da.Fill(ds)
              End Using
          End Using
      End Sub
  
      Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
          Using con As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Infane\Documents\Testdb.accdb")
              Using da = New OleDb.OleDbDataAdapter("SELECT * FROM OperatorDb", con)
  
                  Dim i, OperatorIndex As Integer
                  Dim Department As String
                  Dim FirstName As String
                  Dim LastName As String
                  Dim Password As String
                  Dim EmailAddress As String
                  Dim rw As TestdbDataSet.OperatorDbRow
                  Dim myBuilder As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(da)
  
  
                  'Add a new row to the Operator table.
                  rw = TestdbDataSet1.Tables(0).Rows.Add()
  
                  OperatorIndex = InputBox("Enter your OperatorIndex")
                  Department = InputBox("Enter your Department")
                  FirstName = InputBox("Enter your FirstName")
                  LastName = InputBox("Enter your LastName")
                  Password = InputBox("Enter your Password")
                  EmailAddress = InputBox("Enter your email address")
  
                  rw.Item("OperatorIndex") = OperatorIndex
                  rw.Item("Department") = Department
                  rw.Item("FirstName") = FirstName
                  rw.Item("LastName") = LastName
                  rw.Item("Enter your password") = Password
                  rw.Item("Enter your EmailAddress") = EmailAddress
  
                  Try
                      'Update the Student table in the testdb database.
                      myBuilder.GetUpdateCommand()
                      da.UpdateCommand = myBuilder.GetUpdateCommand()
                      i = da.Update(TestdbDataSet1, "OperatorDb")
                  Catch ex As Exception
                      MessageBox.Show(ex.Message)
                  End Try
                  'Displays number of rows updated. 
                  MessageBox.Show("no of rows updated=" &amp; i)
  
              End Using
          End Using
      End Sub
  End Class
  </code></pre>