Fabii
Fabii

Reputation: 3890

CreateSQLQuery() not executing

I am attempting to delete a specific row w/

session.CreateSQLQuery("DELETE FROM [dbo].[UserTable] WHERE Id = '00000000-0000-0000-0000-000000000000' ").ExecuteUpdate();

but it does not seem to execute the command, any ideas?

Upvotes: 0

Views: 106

Answers (1)

Evan Haas
Evan Haas

Reputation: 2564

You need to use a transaction and commit after the ExecuteUpdate. See the NHibernate reference docs or this Ayende post for example usage.

If still no luck after that, try a profiler to see what SQL, if any, NHibernate is executing.

Note: it's always recommended to use a transaction w/ NHibernate, even if you're just reading data.

Upvotes: 1

Related Questions