-1

I want to execute a script with variables in order to create a new database. At first, i tried with command line but i want to execute the script from another server but i have errors about access rights.

Is it possible to execute a SQL script with fluent nhibernate in the application code?

I've found an answer on that link but it doesn't execute the script, it loads queries.
link

Thanks for help.

1 Answer 1

2

JUST a note: Fluent NHibernate is just a third party library for mapping. To execute script you need just NHibernate.

And in fact, the answer you've found, is the answer. The point of WRITE scripts is to call ExecuteUpdate() at the end

var query = session.CreateSQLQuery("your sql to string with INSERT, UPDATE...");
// that will execute that all
query.ExecuteUpdate();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.