selecting between 2 access databases?

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...
 
G

Grzegorz Danowski

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
 
G

Grzegorz Danowski

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top