user e password puoi passarle ad una Function come parametri, alla fine:
VB.Net
codice:Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim conn As New System.Data.OleDb.OleDbConnection conn = connStringBuilder("victor", "password123") End Sub Private Function connStringBuilder(user As String, password As String) As System.Data.OleDb.OleDbConnection Dim connString As String = "Provider=SQLOLEDB; Data Source=SERVER; Database=DATABASE; User ID=" & user.Trim() & "; Password=" & password.Trim() Dim objconn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(connString) Return objconn End Function

Rispondi quotando