Column does not allow nulls but it's NOT null

This is how I add the row
 Dim PoeRow As MainDataSet.PurchaseOrderEntryRow = Nothing
   MainDataSet.PurchaseOrderEntryDataTable
                PoeRow = MainDS.PurchaseOrderEntry.NewRow()
                PoeRow.PurchaseOrderEntryID = Guid.NewGuid
                PoeRow.PurchaseOrderID = PurchaseID
               MainDS.PurchaseOrderEntry.Rows.Add(PoeRow) ' here the error fires

I attached the stack trace
System.Data.NoNullAllowedException: Column 'PurchaseOrderEntryId' does not allow nulls.
   at System.Data.DataColumn.CheckNullable(DataRow row)
   at System.Data.DataColumn.CheckColumnConstraint(DataRow row, DataRowAction action)
   at System.Data.DataTable.RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction, Boolean fireEvent)
   at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position, Boolean fireEvent, Exception& deferredException)
   at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 pos, Boolean fireEvent)
   at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 pos)
   at System.Data.DataTable.AddRow(DataRow row, Int32 proposedID)
   at System.Data.DataRowCollection.Add(DataRow row)

Open in new window

Mr_EziAsked:
Who is Participating?
 
Mr_EziAuthor Commented:
I tired to declare a new table like this:
  Dim tbl As MainDataSet.PurchaseOrderEntryDataTable = New MainDataSet.PurchaseOrderEntryDataTable
then it worked.

but clearing the table before entering the data doesn't help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.