Dim sConnect as string
sConnect &= "Data Source=" & ServerName & ";"
sConnect &= "Initial Catalog=" & Database & ";"
sConnect &= "User Id=" & UserName & ";"
sConnect &= "Password=" & Password & ";"
addConnection = New SqlConnection
If addConnection.State = ConnectionState.Open Then addConnection.Close()
addConnection.ConnectionString = sConnect
addConnection.Open()
addCommand = New SqlCommand
Do what you want with this SqlCommand