how we change Conection String in VB.NET?

Recommended Answers

What do you mean by change Conection String ?
Please describe it.
If you have some codes please post them.

Jump to Post

It's just a string. Change it like any other string. If you don't know what to change it to please refer to connection string reference.

Jump to Post

All 5 Replies

What do you mean by change Conection String ?
Please describe it.
If you have some codes please post them.

Access example:

Dim strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb"

SQL server example (assuming SQL security is used):

Dim strConnectionString = "Server=localhost;Database=databaseName;User Id=sa;
Password=something;"

@Jim: Did you mean OP tries to use various database system simultaneouly in his app ?
MS SQL(20?? ?), MySql, Access, Oracle, DB2 everything simultaneously. Great Job.

That's certainly possible. I've written many applications that take data from one data source and update another. That requires two different connection strings (using two simultaneous connections). However, the OP might be wanting to change an application to switch from one backend database to another, say Access to MS SQL. That would require only one connection with a change to the connection string.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.