Note that there are some explanatory texts on larger screens.

plurals
  1. PODataSet raises NoNullAllowedException even if a value is passed!
    primarykey
    data
    text
    <p>I'm writing a game server to which many players connect. I load up the DB into a DataSet(strong typed). Every time a player logs in, I add a new row to Messages table using a TableAdapter.</p> <pre><code>code var newRow = _db.Messages.NewMessagesRow(); // _db is a strong-typed-dataset { newRow.Title = title; newRow.Text = text; newRow.ReceiverUID = receiverUID; newRow.Deleted = false; } // I lock the _db.Messages, so it happens one at a time lock ( _db.Messages ) { _db.Messages.AddMessagesRow( newRow ); _adapterMessages.Connection.Open(); _adapterMessages.Update( newRow ); newRow.MessageID = (Int64)_adapterMessages.GetIdentity(); newRow.AcceptChanges(); _adapterMessages.Connection.Close(); } </code></pre> <p>NewMessagesRow() and AddMessagesRow() is auto-generated by VS. I did it by adding a DataSet item(.xsd file) and dragging all the DB tables to it.</p> <pre><code> public MessagesRow NewMessagesRow() { return ((MessagesRow)(this.NewRow())); } public void AddMessagesRow(MessagesRow row) { this.Rows.Add(row); } </code></pre> <p>_db is a DataSet(strong-typed, auto-generated by VS) _db.Messages is a DataTable.</p> <p>while in testing, I get</p> <pre><code>System.Data.NoNullAllowedException: Column 'Deleted' does not allow nulls. at System.Data.DataColumn.CheckNullable(DataRow row) at System.Data.DataTable.RaiseRowChanging(...) at System.Data.DataTable.SetNewRecordWorker(...) at System.Data.DataTable.InsertRow(...) at System.Data.DataRowCollection.Add(DataRow row) at Server.Database.MessagesDataTable.AddMessagesRow(MessagesRow row) </code></pre> <p>AddMessagesRow() gets called only in the code above, and I always set false for Deleted column, but still gets this message...</p> <p>I don't use _adapterMessages anywhere else, but there are other adapters (_adapterUsers, _adapterMatches,... etc) that could be used concurrently.</p> <p>I don't get the exception every time, but if the server runs for sometime(like > 30 min) with about 1000 concurrent players, it happens.</p> <p>Any help or advices will be greatly appreciated. Thanks :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload