I'm trying to relax my constraints while using a data table adapter, but I'm getting a Object reference not set to an instance of an object error. It happens on the line that says ds.DataSet.EnforceConstraints = false;
Generally, I would like to know how to keep a dataTable from enforcing constraints.
ubsmysDataSetTableAdapters.FormSaveDataTableAdapter ta = new ubsmysDataSetTableAdapters.FormSaveDataTableAdapter();
myDataSet.FormSaveDataDataTable ds = new myDataSet.FormSaveDataDataTable();
ds.DataSet.EnforceConstraints = false;
if (isAdmin) ds = ta.GetByUserIdForAdminUser(userId);
else ds = ta.GetByUserId(userId);
ds.DataSet.EnforceConstraints = true;
I'm fairly new to this, so any help would be appreciated.