ds = New DataSet Try For i As Integer = 1 To 4 tm = ConfigurationSettings.AppSettings("telemagic" & i.ToString) & "common" oleconect.ConnectionString = "data source =" & tm & proveedor olecommand.CommandText = "select user,name from users " oleadapter.SelectCommand = olecommand olecommand.Connection = oleconect oleadapter.Fill(ds, "users") ds.Tables("users").PrimaryKey = new DataColumn[] {ds.Tables("users").Columns("userid")} Next Return ds>config file
>add key="telemagic1" value="q:\gestel1\tm4\" >add key="telemagic2" value="q:\gestel2\tm4\" >add key="telemagic3" value="q:\gestel3\tm4\" >add key="telemagic4" value="q:\gestel4\tm4\" >>
>Public Function usuarios(ByRef ds As DataSet) As DataSet > Dim tm As String > Dim proveedor As String = ";provider=vfpoledb.1" > Dim olecommand As New OleDbCommand > Dim oleadapter As New OleDbDataAdapter > ds = New DataSet > Try > For i As Integer = 1 To 4 > tm = ConfigurationSettings.AppSettings("telemagic" & i.ToString) & "common" > oleconect.ConnectionString = "data source =" & tm & proveedor > olecommand.CommandText = "select user,name from users " > oleadapter.SelectCommand = olecommand > olecommand.Connection = oleconect > oleadapter.Fill(ds, "users") > > Next > Return ds > Catch ex As Exception > MsgBox(ex.ToString) > End Try > End Function >