我有下面提到的代码我用它只连接一个数据库。但是为了连接多个数据库我应该怎么做更正考虑我有两个数据库Databse" ABC " AND Database" XYZ "
Imports System.Windows.Forms
Imports System.IO
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class Form1
Dim File1 = System.Windows.Forms.Application.StartupPath & "\Conn.ini"
Dim Connection = "Connections"
Dim sname = "sname"
Dim Dbase = "Dbase"
Dim Uname = "uname"
Dim Password = "password"
Dim servername = ReadIni(File1, Connection, sname, "")
Dim database = ReadIni(File1, Connection, Dbase, "")
Dim usname = ReadIni(File1, Connection, Uname, "")
Dim pwd = ReadIni(File1, Connection, Password, "")
Dim conn As New SqlConnection
Dim CMD, cmd1, cmd2, cmd3 As New SqlCommand
Dim str As String = "Data Source='" & servername & "' ;Initial Catalog='" & database & "' ;User Id='" & usname & "';Password='" & pwd & "'"
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
conn.ConnectionString = str
conn.Open()
CMD.Connection = conn
End Sub