Re: Joining tables from two databases



While ADO can't do a "JOIN" it can draw data from multiple sources (via
several connections) into DataTables and you can search those tables using a
number of built-in methods. I would experiment with a special account that
had the correct (joint) rights to do it on the server.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"T McDonald" <TMcDonald@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FCC3FC47-9BD5-4B40-A1D7-6DCF72649AC4@xxxxxxxxxxxxxxxx
There are two different web accounts. In this case I can't have the same
web
account with rights to both tables. Would there be some way to perhaps
read
data from both tables into the application as DataTables and then do the
select command against the results? Or some other way to use both web
accounts?

Thanks for the help


"William (Bill) Vaughn" wrote:

If both databases are on the same server (and the web account has rights
to
both) you can simply reference the database table using the syntax:

databasename.tablename.owner.column

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"T McDonald" <TMcDonald@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:92A0B035-8D36-4302-9353-C88AF5C5DB0D@xxxxxxxxxxxxxxxx
Both are SQL Server databases on the same server. This is an asp.net
application, each database has it's own accounts.

I'm not really following how you are solving it using a service
account.

As I understand, to create a connection I need to use a connection
string
that indicates the db and credentials I'm using. If I have more than
one
db,
how would I connect to both in order to run a select statement over
both
databases.

"Sundar Narasiman" wrote:

T McDonald,

I would like to know the following
1. Are these 2 databases are SQL Server ?
2. Are these 2 databases living in the same instance of SQL Server ?

You should not connect to these two databases using Web User Name and
Password. This is not the recommended approach.

Your data-access code (assembly) should be living in
the
middle tier of the Server Farm. You should setup a SERVICE ACCOUNT to
access
the data from these 2 databases. The SERVICE ACCOUNT should have
enough
privileges on those 2 databases.

--
Thanks & Regards,
Sundar Narasiman


"T McDonald" wrote:

I am having trouble figuring out how I might do the following, if I
can
do it
at all. I have two databases, each with their own separate
authentication
details.

I have a select statement that gets the data from one table based on
existence in another table in another database. This works fine when
using
the windows authentication. What I don't understand how to do, is to
connect
to both databases in a web project where it is using the webuser
name
and
password. Could someone steer me in the right direction on doing
this.

I hope my explanation is somewhat clear.

Thanks





.



Relevant Pages

  • Security context issue (weird behavior)
    ... The SQL Server is setup to use mix mode authentication. ... The users have a domain account. ... To log in to the SQL server I use an ADO connection. ... I tried to view the pages from another machine with the anonymous access ...
    (microsoft.public.data.ado)
  • Re: SQL Connection String using Domain Account
    ... Web.Config but now have the problem that the web site will not run under ... you can have a username/password set up in sql server - but this would ... The DBA has given me a Domain user account with rights to ... I am unable to get a connection to the database. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Passthrough authenication w/ SQL trusted connection
    ... separate connection will be used for each security context (each user ... account will have it's own pool). ... if you are using a Windows 2000 Domain, ... backend SQL Server. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Connecting to sql server
    ... I hate Visual Basic .NET Standard. ... > I am trying to get a row of data from a SQL Server on our network. ... > I have gone to tools> connect to databases and set up a connection to ... When I test the connection, ...
    (microsoft.public.dotnet.framework)
  • Re: Install Northwind SQL Database?
    ... connection going between Visual Studio and Espress. ... Error connecting to SQL Server 2005 under default settings SQL Server does ... tool for creating and using databases. ... install by default with SQL Express. ...
    (microsoft.public.sqlserver.setup)