First, create a console application in Visual Studio 2017.
Click on the Project and a window will appear, as shown below.
Select Console App (Framework) and give the proper name. You will see the following screen.
Let's start writing lines of code to achieve our task.
Write a few lines of code to create a SQL connection. The below command is used to to open the SQL connection.
The SQL command should be created inside a using statement. It receives SQL statement as first argument.
The SQL command initializes a new instance of the SqlCommand class.
ConnSource.Open() //Open the Connection
Cmds.ExecuteNonQuery // executes SQL statement against the connection and returns the number of rows affected.
Here, I am creating a new table named Projects in my destination dbASPNETCoreDemoDB.
My Source DB is EPM –dbo.msp.
EpmProject_UserView is my view.
Hey, don’t forget to set up your target connection in your app settings, as shown below.