473,396 Members | 1,990 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,396 software developers and data experts.

Multiple connection strings

I am working on a web form using asp.net 2.0. I want to have a
databound dropdownlist control to display 'Company name'.

Here is my problem. I have 2 databases. Database, 'X' and 'Y'.

I am using database 'X' everywhere in the page. But in the 'X' database
I dont have 'company name' it just has 'company ID'. To get 'company
name' I will have to connect to database 'Y' which has both 'Company
ID' and 'Company name' coloumns.

How will I write the sql connectionstring to bind the dropdown control?
So that I can use the Company ID coloumn from 'X' database and match
it with the 'company ID' of 'Y' to display the 'company name' in the
dropdownlist.
Thanks and appreciate the help.

Ahmed

Dec 20 '06 #1
2 1330
"iahmed9060" <ia********@gmail.comwrote in message
news:11**********************@48g2000cwx.googlegro ups.com...
>I am working on a web form using asp.net 2.0. I want to have a
databound dropdownlist control to display 'Company name'.

Here is my problem. I have 2 databases. Database, 'X' and 'Y'.

I am using database 'X' everywhere in the page. But in the 'X' database
I dont have 'company name' it just has 'company ID'. To get 'company
name' I will have to connect to database 'Y' which has both 'Company
ID' and 'Company name' coloumns.

How will I write the sql connectionstring to bind the dropdown control?
So that I can use the Company ID coloumn from 'X' database and match
it with the 'company ID' of 'Y' to display the 'company name' in the
dropdownlist.
You don't mention what RDBMS it is, so the following is based on three
assumptions:

1) that you're using SQL Server

2) that the two databases are on the same server:

3) SELECT permissions are sufficient

In DatabaseX, run the following:

SELECT * FROM DatabaseY..MyTable

obviously replacing MyTable with the name of an actual table in DatabaseY...
:-)

No need to change the connection string...
Dec 20 '06 #2
Yes, Its working..

Thanks..
Mark Rae wrote:
"iahmed9060" <ia********@gmail.comwrote in message
news:11**********************@48g2000cwx.googlegro ups.com...
I am working on a web form using asp.net 2.0. I want to have a
databound dropdownlist control to display 'Company name'.

Here is my problem. I have 2 databases. Database, 'X' and 'Y'.

I am using database 'X' everywhere in the page. But in the 'X' database
I dont have 'company name' it just has 'company ID'. To get 'company
name' I will have to connect to database 'Y' which has both 'Company
ID' and 'Company name' coloumns.

How will I write the sql connectionstring to bind the dropdown control?
So that I can use the Company ID coloumn from 'X' database and match
it with the 'company ID' of 'Y' to display the 'company name' in the
dropdownlist.

You don't mention what RDBMS it is, so the following is based on three
assumptions:

1) that you're using SQL Server

2) that the two databases are on the same server:

3) SELECT permissions are sufficient

In DatabaseX, run the following:

SELECT * FROM DatabaseY..MyTable

obviously replacing MyTable with the name of an actual table in DatabaseY...
:-)

No need to change the connection string...
Dec 20 '06 #3

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

Similar topics

8
by: James Baker | last post by:
I've been using ASP.NET for a couple years now and I'm trying to fall back into ASP for a new position I've acquired...and I'm having a bit of trouble remembering. I'm running to a problem where...
4
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
6
by: Quiet Man | last post by:
Hi all, I'm designing a fairly simple service that will run on W2K/SP4 and W2K3 servers. It's job is to be a very specialized database server that listens on a given IP address / TCP port and...
2
by: smilly | last post by:
I know that normally there is only one connection that you specify in a simple web solution but, now our company is looking into a multiple connection solution. Plase give me comments on how you...
1
by: Mark Richards | last post by:
I am starting to test out using the new gridView, FormView controls with a ObjectDataSource, BUT, my application allows the user to select which database they want to work out of. I am storing...
5
by: Mike Kelly | last post by:
Hi. I've got a standard setup with a web app (ASP.NET 2.0) that I develop on my machine, deploy to a QA server for testing, and then on to a PROD environment. To facilitate the deployment...
9
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a question about storing the connection strings to the database in a config file or database. My manager wants me to store all the connection strings in a database, but I...
5
by: wild | last post by:
My development machine has Win XP pro and IIS 5.1 I have a 'default web site' with 2 virtual directories, let's say 'siteA' and 'siteB'. Both point to the same application in the same phisical...
2
by: pabs1111 | last post by:
Hi All I think I have made a very newbie mistake in my use of Pass Through Queries. I have created pass through queries using the query wizard and then setting the connection string in the...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.