0

I have a sql script file and i want to run that i can use sqlcommand for that but in my appliction im using linq. So i want to know can i run that script through linq if yes how can i do

1
  • Can you store the SQL in a proc? You can call a proc from LINQ to SQL too, in addition to ExecuteCommand. Commented Dec 2, 2010 at 16:02

2 Answers 2

6

Use the DataContext.ExecuteCommand method to send your SQL directly to the database.

Sign up to request clarification or add additional context in comments.

Comments

1

If your script contains multiple statements you will need to parse it and execute them one at a time using DataContext.ExecuteCommand, otherwise things wont go well. How you do this really depends on how your scripts are formatted.

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.