The following example demonstrates how to do it. Here I have my .sql script file as myscript.sql and it is in C:\ directory.
The code for it in C# is as follows:
The code for it in VB.Net is as follows:
Thus this will execute the .sql script file from the .Net code.