SQL table does not allow insert with boolean column set to AllowDBNull = false

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have a SQL database and a table with one of the columns being a "bit". If I set the column to AllowDBNull = true then all works fine. However if I change it to AllowDBNull = false then I get an exception <font size=2>
</font>"Cannot insert the value NULL into column bt, table C:DOCUMENTS AND SETTINGSDB.MDF.dbo.tb; column does not allow nulls. INSERT fails." <font size=2>
workRow[</font><font color="#a31515" size=2>"bt"</font><font size=2>] = true</font><font size=2>;</font> <font size=2>
dsDataSet.tb.Rows.Add(workRow);
tbTableAdapter.Update(dsDataSet.tb); </font>
 
the row is set to true so surely it is not Null?

  <font size=2></font>

View the full article
 
Back
Top