Big Smile
Big Smile

Reputation: 41

How to run ORACLE .SQL file from VB

I have a question regarding execute the file .sql through VB.NET. I've been googling and trying to find the answer but unfortunately there's no straight-forward answer for this question.

Explanation :

There will be a script for drop and create and insert instead from the .sql file.

Thank you very much

Solution of Mine :

After been a while thinking about the best way for doing this is just create the PL/SQL or stored procedure and execute in through VB.NET Scripting

Hope this helps you thank you

Upvotes: 0

Views: 1461

Answers (2)

Steven Doggart
Steven Doggart

Reputation: 43743

I don't know of any simple "run this script" kind of method. So, unless there's some kind of command line you could launch in a separate process, I think you'll find that you need to do the leg-work yourself:

  1. Load the script into a string (check out File.ReadAllText)
  2. Make a connection to the database
  3. Create a command for the connection
  4. Set the text of the command to the contents of the script file
  5. Execute the command

If you have trouble accomplishing any of those tasks, ask another question and I'm sure everyone will be happy to provide you with more specific answers.

Upvotes: 1

Matt Wilko
Matt Wilko

Reputation: 27322

This is a very broad question and is not a good fit for this site:

Have a look at this website or this website for an introduction to ADO.NET with Oracle

Upvotes: 1

Related Questions