Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to get data from 2 different databses?

Reply
Thread Tools

How to get data from 2 different databses?

 
 
Maddog
Guest
Posts: n/a
 
      05-10-2007
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.

ALSO> whats 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

 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      05-10-2007
"Maddog" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.

> ALSO> whats 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

 
Reply With Quote
 
 
 
 
Aidy
Guest
Posts: n/a
 
      05-10-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.
>
> ALSO> whats 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
>



 
Reply With Quote
 
Maddog
Guest
Posts: n/a
 
      05-10-2007
On 10 mei, 11:35, "Mark Rae" <(E-Mail Removed)> wrote:
> "Maddog" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) 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.
>
> > ALSO> whats 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

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      05-10-2007
"Maddog" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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

 
Reply With Quote
 
Maddog
Guest
Posts: n/a
 
      05-10-2007
On 10 mei, 12:14, "Mark Rae" <(E-Mail Removed)> wrote:
> "Maddog" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) 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..

 
Reply With Quote
 
sloan
Guest
Posts: n/a
 
      05-10-2007


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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.
>
> ALSO> whats 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
running same script on same data on two different machines -->different result Christopher Brewster Python 5 11-14-2008 08:19 PM
different instances with different data descriptors with the same name Fabrizio Pollastri Python 2 02-18-2008 12:18 PM
why get different result of a simple code on different compiler? Tao Wang C++ 4 11-09-2005 01:29 PM
Bind different rows to different data sources in data grid AD ASP .Net 1 08-23-2003 10:34 PM



Advertisments