fvancrae
(Frederic Vancraeyveldt)
November 17, 2025, 3:24pm
1
I was wondering if it is possible to disable constraints in the ReadDataTable
Due to simultaneous tasks my DB can become inconsistent.
I have a tool to rectify this by deleting records.
This operation does a ReadDataTable followed by a Delete of records.
I do it this way to trigger the server side business rules
However I get a constraint error on the read.
Probably because my primary key occurs twice in the DB.
Is there a way to disable the constraint?
I realise this is a bit of an excessive question/request. I understand if it is not possible.
An alternative would be to have a custom delete command which also triggers the server business rules.
Is this possible?
fvancrae
(Frederic Vancraeyveldt)
November 17, 2025, 3:28pm
2
Note: The error is in System.Data.DataTable but I assume RO sets them
EvgenyK
(Evgeny Karpov)
November 17, 2025, 3:54pm
3
Hi,
You can update your table inside .daSchema and disable PK.
fvancrae
(Frederic Vancraeyveldt)
November 17, 2025, 4:20pm
4
Hi, I did not want to go this far. I assume the PK attribute has merrit.
I just want to change the constraint one time.
Can I make an onetime modification to the da schema?
FYI: This is my code
var streamer = new RemObjects.DataAbstract.Bin2DataStreamer(tabledata, RemObjects.DataAbstract.StreamerInitialization.ReadFromBeginning);
var dataTable = new System.Data.DataTable(tablename);
streamer.ReadDataTable(streamtablename, dataTable, true,true /*also tried false */);
…
fvancrae
(Frederic Vancraeyveldt)
November 17, 2025, 4:38pm
5
FYI: I think I found the solution myself:
This works
var dataTable = new System.Data.DataTable(tablename);
using (DataSet ds = new DataSet() { EnforceConstraints = false })
{
ds.Tables.Add(dataTable);
streamer.ReadDataTable(streamtablename, dataTable, true, true);
ds.Tables.Remove(dataTable);
}
Thanks stack overflow