Is there a way to connect to two separate databases at the same time through my web application?
In my web.config under the configuration/appSetting I have created two keys for database connection:
<add key="MyConn" value="server=PLMNBK\PLMNBKSQLSERVER;uid=sa;pwd=xxxx;database=SourcingDB" />
<add key="MyConn2" value="server=PLMNBK\PLMNBKSQLSERVER;uid=sa;pwd=xxxx;database=SeaTender" /
This enable me to pass the connection string to a session variable through a dropdownlist box and connect to the desired database.
However, I would like to create a dataset from two tables which are not in the same database, one in the "SourcingDB" and the other one in the "SeaTender".
Thanks for some guidance.
PLMOne option might be to use the 3-part naming convention in you query(s) - ( assuming you have cross db permissions and both catalogs are located on the same server).
Something like:
FROM <DatabaseName>.<OwnerName>.<ObjectName>|||Thanks,
Actually both databases are on the same server, if I understand well the "From<Databasename>.<OwnerName>.<ObjectName>" syntax should be in my SQL Select clause? Am I right?
Slts.
PLM|||checkout books on line about OPENDATASOURCE.
hth|||>>if I understand well
You are right.
No comments:
Post a Comment