.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

ASP.NET Web Application connecting to multiple databases

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
Hi Experts,I am supposed to develop an enterprise-class ASP.NET Web Application that connects to multiple databases. For example when the web form loads, I should populate different ASP.NET controls (GridView, DataPager, TextBox, DropdownList etc) from multiple databases (SQL Server, Oracle, DB2, SAP Server etc) and also, edit the data in the controls and save the data to the respective databases on button submit.Ideally, what should be approach? Should I use Web Service or WCF for data integration, if so is there a limit on the size of the data?What should be the architecture considering the application should be scalable and easy to maintain?Pardon my ignorance.Thanks

View Complete Post

More Related Resource Links

Windows Forms: Give Your .NET-based Application a Fast and Responsive UI with Multiple Threads


If your application performs any non-UI processing on the thread that controls the user interface, it may make the app seem slow and sluggish, frustrating users. But writing multithreaded apps for Windows has long been restricted to C++ developers. Now with the .NET Framework, you can take advantage of multiple threads in C# to control the flow of instructions in your programs and isolate the UI thread for a fast and snappy user interface. This article shows you how. Also, it discusses the pitfalls of multiple threads and presents a framework for safe concurrent thread execution.

Ian Griffiths

MSDN Magazine February 2003

Multiple domains in single asp.net mvc application




I want to use my asp.net mvc application with multiple domains (maybe of hundreds),

so I have created custom Route class that matches requests including domain.

Each domain could has different routes, so the number of routes in RouteTable can be huge

(eg 500 domains, each 20 routes = 10000 routes in RouteTable).

I am considering how it will be efficient?


I have an idea to replace RouteTable.Routes (of type RouteCollection)

with custom one (of type Dictionary<string, RouteCollection>).

But how I can override default route matching mechanism with my custom mechanism which will be two step:

1) retrieve RouteCollection from dictionary based on domain name

2) retrieve specyfic Route object (standard route matching mechanism)

How can I do this?


Maybe someone has better idea for solving this problem?


Thanks in advance


Running a single SQL update query on multiple foxpro databases

Hi, Env : SSIS 2008 My requirement is to run a update SQL statement on multiple foxpro databases. The fox database paths are available in a SQL server table.  I've created a for each loop control and assigned the database path to a variable named dbpath. Within the loop, I added an "execute sql task" control. Now what properties are to be set to get the requirement done. Appreciate any help. Regards. BH  Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH

SQLCE 3.5 connection from multiple application, data refresh

I have a native application (wm 6.5) using oledb to connect to a database. *******************************************************************************   result=CoCreateInstance(CLSID_SQLSERVERCE_3_5,0,CLSCTX_INPROC_SERVER,IID_IDBInitialize, (void**)&database);   ... // set properties  database->Initialize(); ******************************************************************************* This part of the app simply queries a single table for all records (query wrapped in a transaction of it own). I believe it is recommended that you keep a single connection for as long as possible, and therefore just create a new session each time I query the table. There is a second application (c#) which my application executes and then waits for. It updates and inserts new records. when the c# app closes and I get control back, my app then runs another query to see if anything has changed. My issue is that, the only way I can get the updated data is to un-initialize and re-initialize the database (IDBInitialize) interface created above.  Is there some properties I should be setting on the session/database in order for this to work. Or do I really have to spawn a new connection for every query?   Thanks in advance. Dylan

Using Windows Authentication for connecting sql server from web application using froms authenticati

Hi Experts, I have one web application which is configured to be use froms authentication. But, I don't want to use SQL Authentication to connect to SQL server, I want to use windows authentication. Can somebody plase give me detailed setps for how to implement this? Thanks for your help in advance. -Chintak. 

master pages / connecting to databases / classes

I have a scenario where I pick up users and query them from active directory for a project, I've put the connection to database etc into the master page.cs for the meantime.Questions are:This is probably not the best place to put the connection query code, as it will do the query everytime the user goes to another page...correct?Would a better scenario be to pick the userDetails up on initial contact then carry the userDetails to each other page, can you use sessions to check if it is indeed that user? Thinking PHP here.Any thoughts would be appreciated!

Multiple databases on same instance - performance hit?

Hi I am not a SQL person to please excuse me if my terminology is wrong :) We are running SQL 2005 at the moment on Windows 2003 SP2 servers. We have multiple SQL servers spread around in each of our data centres. We have an application we're going to be bringing in that needs it's own SQL database. We need to decide whether we build a dedicated SQL server for this or just create a new database on an exisiting SQL instance. The advantages of the former are that we don't max out any existing servers and affect the performance of other databases, whereas with the latter we save the cost of having to build a new server. For those of you that use SQL heavily, what's the general way of doing things? I know that SQL is memory, disk intensive etc so not sure.

Use of having multiple Services for single silverlight application

Hi My project have 4 modules, I have decided to use single service with multiple interface (1 interface for 1 module, i.e totally 4 interfaces) and multiple partial class ( 4 partial class). Partial classes use this interface. But I have another thought of using multiple service ( 4 services, i.e for each module one service class (.svc)). Please let me know, which approach is right? 

Problem: Sessions got mixed up when open multiple tab for a sigle application

We got a problem that Sessions got mixed up when open multiple tab in a single application. We could change the code that do not use session variable in a that level, but a tons of page need to be modified. We need to find a quick fix for this problem. Is any thing we can do in code level to prevent user open multiple tab in a single application? O any thing we can do to keep its own session for a single tab?

application_start event called multiple times in MVC application

hi, In my MVC application ,I am updating my web.config at runtime through application_start event.So, ideally it should be done only when the application is started.BUT in MY mvc application the application_start event of global.asax is being called multiple times , even when i have not restarted the application. Its being repetadly called when i am calling different actions , so the webconfig is repetedly updating & making my application very very slow. Can you please let me know , what's the reason & how to handle this .   Thanks in advance gbhatnagar    

Web Application Deployment with Multiple Web Applications.

I have a website that I would like to deploy. In that website, there are a few class libraries, main web application, and other child web applications. so it's like this. lib1 lib2 main app sub app sub app ...   Each sub app's are separate project and each are virtual directory applications under the main application. I followed these two links below to teach myself and kind of got a idea that I have to create each Web Deployment Project for each web applications. MSDN site briefly talks about how I should use msbuild <ItemGroup> tag to merge the multiple applications together, but doesn't give me enough clue on which deployment project I should write this (prob. main?) or how I can translate the nested IIS structure, etc.  I read about msbuild but I still have no clue.  Each deployment projects deploy successfully without the nesting relationship though.  e.g. I can deploy mailApp.vbproj_deploy and subApp.vbproj_deploy separately and appears under IIS fine. But that's not what I really would like to do.. Could someone tell me how I could possibly achieve this?  Any help would be appreciated.    http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx http://msdn.microsoft.com/en-us/library/aa479568.aspx  

Deploy XBAP application with WCF Service Reference into multiple environments

Hi, we have a multiple environment setup (local, Development servers, QA servers, prod servers, etc.) and we are building an XBAP application that uses WCF Services to connect to databases.  We code and unit test everything locally and then deploy to our Development servers for more thorough unit testing.  The issue that we are having is that we don't see how to update the deployed XBAP application to use the Development server deployed WCF Service.  The only way we've been able to do this is by having to change the reference on my local machine, complie, and redeploy the XBAP.Question:  How do we configure a deployed XBAP's Service Reference to point to the same service on a different server than what it was originally compiled/deployed with?  (Like in some configuration file...NOTE: but we also don't see a config file after deploying the XBAP.)  We don't want to have to update the Service Reference for QA, Prod, Training, Stage, etc. on our local machines, compile and redeploy every time we need to migrate the application to a new environment.Thanks!

Steps to performance tune multiple databases with multiple stored procedures

I have a sql2008R2 server with approximately 10 databases and 1400 stored procedures that will eventually support a website.  I currently have 3 sql2008 machines doing the same in production.  The goal of the new server is to remove all non-clustered indexes and performance tune all the stored procedures using the sql tuning adviser and then compare the performance to what we have in production.  I have been dragging my feet on this project as I dont really know where to start as many of the procs exec other procs and access many database objects.  I feel that there should be a specific order in how I start this project and I am looking for some advice from other users that may have had a similar project.   Thanks in advance.

Multiple databases backup/restore in a transaction, if possible, into only one file


Hi dear,

I have three databases named XDW, XOLTP, XOLTPSchema. All of these are for only one application. In the application, user should do backup/restore using GUI.


1. How I should do backup/restore in one transaction? i.e. all of three actions should be success elsewhere all of them should fail.

2. Is it possible to backup them into only one file e.g. X.bak?

3. Or, What is the standard solution in this condition?

Thanks in advance.

How To: Joining multiple DataTable using “LINQ to DataSet”

Database snapshots do not work well with databases having multiple log files


It appears there is a bug in the implementation of database snapshots.

If you create a snapshot on a database with multiple log files:

Then restore from the snapshot:

then all of you log files, but one will disappear. As a result the backup command will fail with the following message:
Msg 3636, Level 16, State 2, Line 1
An error occurred while processing 'BackupMetadata' metadata for database id 12 file id 10.
Msg 3046, Level 16, State 2, Line 1
Inconsistent metadata has been encountered. The on

Connecting to SQL Server 2000 over HTTP from a C# application



    I have developed a Windows Forms application and I require it to connect to a remote database (in another country) over HTTP. Is it possible. If so can someone guide me to it.



Ammar Hassan

session variable and multiple web application instance


 I have a web application using window authentication. There are a search page and a edit page in the application. 

In search page, user can enter some search criterias in the textboxes and the search result will be displayed in the gridview by clicking the "Search" button. User can select any row from the gridview and it will take him to the edit page. 

 In the edit page, there is a "Back" button to take the user back to the search page. I use session variables to remember what the search criterias the user entered in the textboxes and what page number the user was in the gridview. So when the user goes back to the search page, the textboxes are pre-populated with the search criterias and the gridview is displayed in the correct page number.

The problem is:

If user1 opened one browser window and did a search using search criterias1, then user1 opened a 2nd browser window and did a search using search criterias2. When the user1 went back to the search page from the edit page using the first browser window, all the textboxes and page numbers are from the 2nd browser window, instead of the 1st one.

Can anyone explain this problem to me and how to prevent it? It will be helpful too if you can give me some links about the similar problem.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend