In VB.NET, you need to add a module and write few functions there. And use these function to establish and close connection to Database.
Variables:
ConnectionString variables (both)
Functions:
- Close_Database_Connection(): If connection is open then close it.
- Create_Database_Connection(condition_param): Here you put your
conditions in If Else Structure. Like:
Code:
If ( condition ) Then
use connection String 1
ElseIf (condition) Then
use connection String 2
End If
Use this "Create_Database_Connection(condition_param)" Method where you need to establish connection in code depending upon you conditional parameters.