Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27210

Need Code for changing "ConnectionString" in VB 2012 Project

$
0
0
I am new to VS 2012, coming from VB5 using a Win 8 Computer.

I am creating a Windows Form which will run on a computer on a local network at a customer location. The Network Name of the computer with the database I need to access will not be known until I install the program; so I have a Database file (dbLocation) on each computer that contains the networkname of the computer with the mdb Databases I need to access.

I created the connection to the database with the Wizard which automatically generated the DataSet, Binding Source, Table Adaptor and TableAdaptorManager for each database in the project.

After researching Google, I can't find where to place any of the code examples of changing the "connection string" at runtime.

So, please help me with the code to change the "ConnectionString" at runtime and where it should be placed in my trial project shown below. Note that my project will have at least two databases, the "DbLocation" database is always in every computer and the project needs to know where to look for the other databases to get to them.

Thanks in advance!!!!!!

Option Explicit On
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.OleDb.OleDbException
Imports System.Configuration

Public Class FormDeiAutoBackupVS
Public Sub New()
InitializeComponent()
Me.CenterToScreen()
End Sub

Private Sub FormDeiAutoBackupVS_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.SystemMsgsTableAdapter.Fill(Me._DEI_SystemMsgsDataSet.SystemMsgs)
Me.DbLocationTableAdapter.Fill(Me._DEI_dbLocationDataSet.DbLocation)
End Sub
End Class

Viewing all articles
Browse latest Browse all 27210

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>