Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:55:16+00:00 2026-05-27T14:55:16+00:00

I have three databases on three different servers that I need to join and

  • 0

I have three databases on three different servers that I need to join and show the result in a asp:gridview. I have the query working now as the result of asp:SqlDataSource using the connection string to one database, but my problem is that I specify the server, database and table for the other two databases.

  1. How do modify my query to use a connection string to all of the
    databases (C#, asp example)?
  2. Do I do my query in the aspx file or should I do the query in the cs file?
  3. How do I attach my result to the gridview if I do the join in the cs file? The data could be different once I leave this page and come back.

My current <asp:SqlDataSource> code is this –

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
SelectCommand="SELECT DISTINCT A.batchname AS IndexBatchNumber, a.clientkey, a.packagetrackingid, a.statusflag, f.Name AS Client, SELECT GroupValue FROM FSDev.dbo.ClientGroup WHERE ClientKey = a.clientkey AND GroupCode = 'TIME ZONE') AS Timezone, (SELECT fc.special_instr FROM SQL2.sysdba.FC_SLX_TEST.FC_PKG_TRKG fc WHERE
fc.fc_Pkg_trkgid = a.PackageTrackingID) AS RushFunding FROM BatchExport a, InvoiceExport b, FSDev.dbo.Clients f WHERE a.batchname = b.batchname AND a.clientkey = f.ClientKey AND a.statusflag = 1 "></asp:SqlDataSource>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:55:17+00:00Added an answer on May 27, 2026 at 2:55 pm

    I have been able to solve this by doing two things. Since the databases are all MSsql, I used the link capabilities to join them together. That way I only have to have a single connection string. In order not to have to change the SQL code when moving to production servers, I had the DBA create stored procedures for all of my queries. This way I only have to change the connection strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I have two mysql servers that have different jobs (holding different databases) but
I need a Query that without any changes work on these three different database
I have an application that needs to join tables from multiple databases into a
I have a sproc that runs on many different servers. In the sproc I
I have a fairly complex SQL query that pulls different types of products from
I have about 100 databases (all the same structure, just on different servers) with
I currently have four different servers all with many databases on them. Each server
We have three developers and one tester all working against the same database. We
I have a MySql database with three tables I need to combine in a
I have a PHP script that reads and writes from multiple databases. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.