AntoniaLazari

Hi,

I added a new datasource in my VB project and i want to change the connection string of the datasource at runtime. How can I do this



Re: .NET Framework Data Access and Storage How to change the connection string in VB.NET at runtime?

M. Dirksma

Code Snippet

Dim s As New OleDb.OleDbConnection()

'connect, query do some fun stuff and close
s.Close()

'and connect to another db
s.ConnectionString = "connectionstring"
s.Open()


Not sure what u meaning but u can just edit the connectionstring property and reopen the connection.