I do not think that you can directly use the connection created by the IDE, as if it were one of your project settings. However, the IDE provides similar functionality through project properties.
As you get to the properties, you change a little what language configuration / default you use. But in general, you should be able to try these steps and see if they provide the necessary functions:
- Open the project.
- Locate the project in Solution Explorer and select the project.
- In the "Project" menu, select the "Project Properties" menu item.
- The project properties tab opens. Select the "Settings" blade.
- If you do not have settings, you will be given the opportunity to create a settings file. Do this if necessary.
- In the displayed grid, select the first blank line and enter "ConnectionString" in the name field.
- Select "Connection String" from the drop-down list.
- Click in the value box. When you activate this field, a small extension button should appear with the inscription "...". Click on it.
- The Connection Settings dialog box appears.
- Select a selection from the drop-down list.
- Set up your login credentials as you wish.
- Select your database from the drop-down list.
- Check connection. If everything is ok, click "OK" twice to return to the settings page.
- Save the settings.
You should now be able to access this connection string from the project code.
VB.Net:
Dim cs = My.Settings.ConnectionString
FROM#:
var cs = Properties.Settings.Default.ConnectionString;
source share