I've a small program in Linq that inserts records in my database based on a number of conditions (depending on existing data in the same db). The SQL output are lots of SELECT and INSERT statements. In my production environment this should be executing from a SQL script and reviewed first. Is it possible to generate the SQL output without actually running the query?
Asked
Active
Viewed 311 times
0
-
1you can use a TransactionScope and just dont complete it – MThiele Jul 04 '19 at 08:29
-
I've tried doing this by adding this code in the bottom `using (TransactionScope ts = new TransactionScope()){ SubmitChanges(); }` but strangely, the generated SQL does not work when running it seperately ("Error 547: The INSERT statement conflicted with the FOREIGN KEY constraint"), while the LINQ code works fine if I complete the Transaction. – BTC Jul 04 '19 at 11:49
-
without code i can't help you in this case – MThiele Jul 05 '19 at 23:51