selecting between 2 access databases?

  • Thread starter Thread starter Eych
  • Start date Start date
E

Eych

here's the scenario:

Database1.mdb with Table1 with Field1
Database2.mdb with Table1 with Field1

in vb.net, how can I return all of the Field1's from both tables/databases?

I can create a dataset from each table, but how can I combine them into one?
I want to load all instances of Field1 into a dropdown...


thanks...
 
Uzytkownik "Eych said:
here's the scenario:

Database1.mdb with Table1 with Field1
Database2.mdb with Table1 with Field1

in vb.net, how can I return all of the Field1's from both
tables/databases?

I can create a dataset from each table, but how can I combine them into
one?
I want to load all instances of Field1 into a dropdown...

There are two solutions:
1) use two connection object, two data command and two data adapter filling
the same dataset,

2) use one connection but select data from two external database (access
specific sytntax), for example:

Public Sub FillDS()
Dim cmd As New OleDbCommand
cmd.CommandText = "Select myName From tblTest " + _
"Union All Select myName From tblTest In
'E:\B.mdb'"
cmd.Connection = con

con.Open()
Dim da As New OleDbDataAdapter(cmd)
da.Fill(myDs, "Test")
con.Close()
End Sub

Regards,
Grzegorz
 
Uzytkownik "Eych said:
here's the scenario:

Database1.mdb with Table1 with Field1
Database2.mdb with Table1 with Field1

in vb.net, how can I return all of the Field1's from both
tables/databases?

I can create a dataset from each table, but how can I combine them into
one?
I want to load all instances of Field1 into a dropdown...

There are two solutions:
1) use two connection objects, two data commands and two data adapters
filling
the same dataset,

2) use one connection but select data from two external database (access
specific sytntax), for example:

Public Sub FillDS()
Dim cmd As New OleDbCommand
cmd.CommandText = "Select myName From tblTest " + _
"Union All Select myName From tblTest In
'E:\B.mdb'"
cmd.Connection = con

con.Open()
Dim da As New OleDbDataAdapter(cmd)
da.Fill(myDs, "Test")
con.Close()
End Sub

Regards,
Grzegorz
 
Back
Top