473,386 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to get data from 2 different databses?

Hi all,

i hope someone can post a solution to my problem, i am a beginner and
work with
visual web developer express edition.

what i am currently working on is an interactive web-page that
displays project information data.
The problem i am having is as follows:
I have 2 databases, one contains the PROJECT information, the other is
the CRM database.
I want to display the contacts name of an project into a textbox,
but the problem is the projects DB only contains the contacts ID
number, stored by project No.
The CRM database stores the contacts name by ID number.

to sum it up, what i need to do is Query the contacts name from CRM
DB, with contact ID and project No
as parameters. The contact ID is stored under the project No in the
PROJECT DB.
The project No is entered by the user in a textbox, with a submit
button.

so its >Get project number,(entered by user in a text box) Then get
contact's ID from PROJECT DB,
Then get the name from CRM DB with the ID AND project No.

And at last it must display this contacts name in a text box.

ALSOwhats a pain is that the field of PROJECT DB which contains ID
data is DIFFERENT than
the field from the CRM DB ( one is string the other integer)
any ideas would surely help,
thanks in advance.
Tommy

May 10 '07 #1
6 1135
"Maddog" <ma********@lycos.comwrote in message
news:11**********************@y5g2000hsa.googlegro ups.com...
The problem i am having is as follows:
I have 2 databases, one contains the PROJECT information, the other is
the CRM database.
No problem.
ALSOwhats a pain is that the field of PROJECT DB which contains ID
data is DIFFERENT than the field from the CRM DB ( one is string the other
integer)
No problem.

However, you've forgotten to tell us the one absolutely vital piece of
information we need in order to help you...

What database is it?

--
http://www.markrae.net

May 10 '07 #2
Assuming it is SQL server you refer to other databases like this;

dbname..tablename

So from Database A you can

SELECT field FROM DatabaseB..SomeTable WHERE ....

"Maddog" <ma********@lycos.comwrote in message
news:11**********************@y5g2000hsa.googlegro ups.com...
Hi all,

i hope someone can post a solution to my problem, i am a beginner and
work with
visual web developer express edition.

what i am currently working on is an interactive web-page that
displays project information data.
The problem i am having is as follows:
I have 2 databases, one contains the PROJECT information, the other is
the CRM database.
I want to display the contacts name of an project into a textbox,
but the problem is the projects DB only contains the contacts ID
number, stored by project No.
The CRM database stores the contacts name by ID number.

to sum it up, what i need to do is Query the contacts name from CRM
DB, with contact ID and project No
as parameters. The contact ID is stored under the project No in the
PROJECT DB.
The project No is entered by the user in a textbox, with a submit
button.

so its >Get project number,(entered by user in a text box) Then get
contact's ID from PROJECT DB,
Then get the name from CRM DB with the ID AND project No.

And at last it must display this contacts name in a text box.

ALSOwhats a pain is that the field of PROJECT DB which contains ID
data is DIFFERENT than
the field from the CRM DB ( one is string the other integer)
any ideas would surely help,
thanks in advance.
Tommy

May 10 '07 #3
On 10 mei, 11:35, "Mark Rae" <m...@markNOSPAMrae.netwrote:
"Maddog" <maddog2...@lycos.comwrote in message

news:11**********************@y5g2000hsa.googlegro ups.com...
The problem i am having is as follows:
I have 2 databases, one contains the PROJECT information, the other is
the CRM database.

No problem.
ALSOwhats a pain is that the field of PROJECT DB which contains ID
data is DIFFERENT than the field from the CRM DB ( one is string the other
integer)

No problem.

However, you've forgotten to tell us the one absolutely vital piece of
information we need in order to help you...

What database is it?

--http://www.markrae.net
ow...
now let me see the PROJECT databse is an Acces DB
and the CRM DB is an SQL database.
these are all connected in my Database explorer.
ive also tried to do it with datasets/tableadapters but i cant get it
to work.

was that what you were missing?
thanks in advance

May 10 '07 #4
"Maddog" <ma********@lycos.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
>However, you've forgotten to tell us the one absolutely vital piece of
information we need in order to help you...

What database is it?
ow...
now let me see the PROJECT databse is an Acces DB
and the CRM DB is an SQL database.
these are all connected in my Database explorer.
ive also tried to do it with datasets/tableadapters but i cant get it
to work.

was that what you were missing?
Yes - makes a bit of a difference, don't you think...? For all we knew, you
could have been using Oracle and MySql etc...

Anyway, you have several options.

Firstly, does your PROJECT database *have* to stay as a Jet database? (N.B.
Jet is the RDBMS which Access and other apps use, usually having a .mdb
extension.)

If it doesn't, just import it into SQL Server and write some queries with
some joins...

If it does have to stay as a Jet database, then you have two main choices:

1) create linked tables in your PROJECT database which point to your CRM
database
http://office.microsoft.com/en-us/ac...004941033.aspx

2) create a linked server in your CRM database which points to your PROJECT
database
http://msdn2.microsoft.com/en-us/library/ms190479.aspx
--
http://www.markrae.net

May 10 '07 #5
On 10 mei, 12:14, "Mark Rae" <m...@markNOSPAMrae.netwrote:
"Maddog" <maddog2...@lycos.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...
However, you've forgotten to tell us the one absolutely vital piece of
information we need in order to help you...
What database is it?
ow...
now let me see the PROJECT databse is an Acces DB
and the CRM DB is an SQL database.
these are all connected in my Database explorer.
ive also tried to do it with datasets/tableadapters but i cant get it
to work.
was that what you were missing?

Yes - makes a bit of a difference, don't you think...? For all we knew, you
could have been using Oracle and MySql etc...

Anyway, you have several options.

Firstly, does your PROJECT database *have* to stay as a Jet database? (N.B.
Jet is the RDBMS which Access and other apps use, usually having a .mdb
extension.)

If it doesn't, just import it into SQL Server and write some queries with
some joins...

If it does have to stay as a Jet database, then you have two main choices:

1) create linked tables in your PROJECT database which point to your CRM
databasehttp://office.microsoft.com/en-us/access/HA102004941033.aspx

2) create a linked server in your CRM database which points to your PROJECT
databasehttp://msdn2.microsoft.com/en-us/library/ms190479.aspx

--http://www.markrae.net
ok,

Ive seen the links, but i dont think they apply for me,
what i really want to do is construct this inside the Dataset page
with TableAdapters.(in visual web developer)
the project databse i can edit, but not the CRM DB (read only).
Ive tried to set this up with the datasets but u just can't construct
a query there which
is dependant on a Query of another DB..

May 10 '07 #6


I'll give you a generic example:

You have Employees in one db (DB1) and Depts in a second db (DB2).
Create a strong dataset. OrgDS

Two tables.
Employee
Dept
OrgDS empDS = new OrgDS();
//populate it from DB1, just the Employee table

OrgDS deptDS = new OrgDS();
//populate the Dept table from DB2

OrgDS combinedDS = empDS.Merge ( //some overload here ) ;
That's a basic template. You can clean it up some, after you figure out the
tricks.

Personally, I've merged different tables.
different rows in the same table ( Like fulltime employees on one db, but
partime emps in a second db, but NO overlap).

If you have some columns from DB1, and some columns from DB2 of the same
table, that's where .Merge becomes very very tricky and doesn't work the way
you want it to.

...



"Maddog" <ma********@lycos.comwrote in message
news:11**********************@y5g2000hsa.googlegro ups.com...
Hi all,

i hope someone can post a solution to my problem, i am a beginner and
work with
visual web developer express edition.

what i am currently working on is an interactive web-page that
displays project information data.
The problem i am having is as follows:
I have 2 databases, one contains the PROJECT information, the other is
the CRM database.
I want to display the contacts name of an project into a textbox,
but the problem is the projects DB only contains the contacts ID
number, stored by project No.
The CRM database stores the contacts name by ID number.

to sum it up, what i need to do is Query the contacts name from CRM
DB, with contact ID and project No
as parameters. The contact ID is stored under the project No in the
PROJECT DB.
The project No is entered by the user in a textbox, with a submit
button.

so its >Get project number,(entered by user in a text box) Then get
contact's ID from PROJECT DB,
Then get the name from CRM DB with the ID AND project No.

And at last it must display this contacts name in a text box.

ALSOwhats a pain is that the field of PROJECT DB which contains ID
data is DIFFERENT than
the field from the CRM DB ( one is string the other integer)
any ideas would surely help,
thanks in advance.
Tommy

May 10 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Aaron | last post by:
I've been using MySQL for several months and enjoyed great success when installing other people's scripts to databses I make using phpMyAdmin. My challenge is developing from scratch the...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
9
by: gopi | last post by:
when installing db2, it only asks for installation directory and does not ask where it is going to store data files. how can i change the default directory after installation.
10
by: Niklas | last post by:
Hi Before I start coding I need to be sure that nobody else has not done it yet and that I can use it. I need an import utility which import data from Excel to a database or some object in...
17
by: Timothy.Rybak | last post by:
Hello all, This is my first attempt at an application, so kid gloves are appreciated. I need to make a very simple form that only has a few elements. One is TraceCode - a text field that is...
3
by: Ralph Smith | last post by:
I have two identical databases on two different servers and I need to add the data in tables from one server to the tables in the other server. Is there a way to do that in mysql? thanks, Ralph
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
0
by: nomad | last post by:
Hi, I have a maintenance site which can access several databses. I want to be able to see if any changes have been made on the site before the user is able to switch to another database. Is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.