How to get datasource name dynamically from .txt / .xml file using 2.0 with Mysql 5.0

I am using C#.Net 2.0 With MySql 5.0. I created a project and it works fine in my machine. But problem occurs when i try to run the project other than my machine. I wrote datasource=mysystem name in connection string. Is it possible to get datasource name dynamically from a text file (*.txt) or from .xml file for MySql.



4/2/2008 6:38:09 AM 1929 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 5

Add an App.Config file to your project and you can drop a connection string in there like so:

    <add name="PICK A NAME" connectionString="YOUR CONNECTION STRING"/>

You can then use ConfigurationManager to read it.

Hope this helps,




"Talk is cheap. Show me the code." - Linus Torvalds
4/2/2008 8:38:51 AM


    <add connectionString ="server=SELVA-CF26A1B7B\SQLEXPRESS;integrated security=true;database=senthil" name ="ConStr"/>


 put it within the configuration section of the web.config file.

And in your DataAccessLayer get the ConnnectionString using the below like code.


string str = ConfigurationManager.ConnectionStrings["ConStr"].ToString();

similarly you can use the <appsetting> tag of the web.config file for this kind of purpose.


If you want to use the text file mean you can get it using streamreader and streamwriter of System.IO namespace.

4/9/2008 5:43:50 PM

Similar Artilces:

.Net 2.0 Web application using is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one web application using which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

Application created in new version of .NET (3.0 or 3.5) can use the library created in older version of .NET(i.e.-1.0 or 2.0)?
Hi All, I am using Visual Studio .NET compiler for compiling my application . We have plugins (as library) which the user can write by their own in .NET . We are building our code in Visual Studio 2005 but we have already some plug-ins which are written in previous versions of Visual Studio (i.e. 2002 and 2003). Is these plug-ins will work with the new build of the application or I need to build these plug-ins as well in Visual Studio .NET 2005. These plugins are created as library. Is their any differences between .NET 1.0, 2.0 and 3.0 because of which the old libraries (created in o...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0 #2
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! There are too many differences for one email - - from 1.0 to 1.1 (not a whole lot of real change, other than fixes, at least compared to 1.1 to 2.0) With 2.0, there were many new declarative controls, with many new ideas added in With 3.0, it's a superset of 2.0 - instead of replacing the installation completely, it just 'added on' new functionality - I would...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! Have a look into this links Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that m...

Error with using .Net 3.0 instead of .Net 2.0
Hi,  I have recently made a website in microsoft visual web developer 2005.  When I have uploaded my site to my host I am having trouble.  when I visit the page I get an error message.  My web hosting company does not support .net 3.0 but instead use .net 2.0.  My website is made with file extensions .aspx.  I am usure how to tell what version of .net I am using and wether this is the only cause.  At first there was a 403 error occuring. Help would be much appreciated as I have been struggling with this for some time. The version...

How to change .Net framework from Version= back to Version= ?
Hello, Can anyone tell me how to change .Net framework from Version= back to Version= ? I have 2 different versions of Visual Studio: VS2005 and VS2008. One is running in .NET framework and the other one is running in framework version  When run the web application that is in framework Version in VS2005, I get the error below.  In the web.config of the project, there is no 'System.Core....' assembly listed in the Assemblies section and all other system assemblies are in framework version Also I checked the Mic...

NW6.5 sp6 Apache 2.0.59 MySQL 4.0.26a PHP 5.0.5
Hi! We have Novell SBS 6.5, a tree with 3 servers: 1. Border Manager sp1 2. GroupWise (NAT) sp1 3. WEB (NAT) sp6 - Apache 2.0.59, MySQL 4.0.26a and PHP 5.0.5. Before upgraded the third server from sp1 to sp6 we used PHP 4 with MySQL 4.0.26a without problems. Now, when I try to work with phpMyAdmin 2.6.4-pl3, it displays partial DB information (tables format), but most other actions cause to Apache to crash with the following message on server console: 8-27-2007 8:28:11 am: SERVER-5.70-2187 [nmID=D0006] Removed address space because of memory prote...

How to get new web app to use .NET 2.0 on Win2K server using .NET 1.1 as default framework?
I have .net framework1.1 and 2.0 on our server running win2K. i have existing applications that uses 1.1, i also have a new app that use 2.0.  how can i set my new .NET 2.0 app to point to 2.0 without messing up my existing .NET 1.1 apps? To specify the ASP .Net version fro a web application, do the followingIn IIS Manager select the web application -> Properties -> ASP.Net TabSelect  ASP.Net version you want to use for the applicationRegards,PrashantDont forget to click "Mark as Answer" on the post that helped you. But I am running Win2K...

.NET 3.0 or .NET 2.0?
I'm going to move my exiting software to .net soon. I'm just wondering if I should wait for the .NET 3.0 framework to be released or if I can start with the 2.0 now? I'd say you can go ahead and move your code to .Net 2.0 as .Net 3.0 uses the CLR version 2.0.Basically, .net 3.0 is .net 2.0 PLUS some new features for presentation (GUI), communication and workflow process.  So the compiler as well as the language features used by the 2.0 runtime will be the same in 2.0 and 3.0"Never argue with an idiot; He will drag you down to his level and beat you with experienc...

Access .Net 2.0 Application from .Net 2.0 Web Site
I need to populate a specific form in a .Net desktop application from a .net web application.  Is there an easy way to go about this? Hi, Based on my understanding, you want to start an executable application from your ASP.NET websit, right? We can invoke Process.Start method ( to launch an executable application from ASP.NET application. Note: Please keep in mind, the ASP.NET application is running on the server, so it will start the executable application that exists in the server.   I look...

Clickonce deployment anyone (DW.NET 2.0 and .NET 2.0)?
I saw someone had posted a question about this already, and there were no responses. So I am hoping that this will get some. We had problems with the previous version of DW.NET 1.5 + VS2003 when attempting to deploy applications via a web server. So many problems that we eventually decided to run off a network drive (which is OK if your user base doesn't roam around the country). Anyway, we gave up on DW.NET, and started to use the datagrid control. Since then, much has changed. Our development team now has VS2005 professional and may start using DW.NET 2.0 (pending my inv...

Will AJAX Extensions 1.0 (for .NET 2.0) be affected by .NET 3.0?
Hello all,I have a web server that has a couple of site running using .NET 2.0 with the AJAX Extensions 1.0 (but not the ControlKit) and I need to install another Web App site that uses .NET 3.0. I need to know if installing .NET 3.0 will affect the sites that currently use 2.0 and the AJAX Extensions 1.0 as these sites are live and any down time would get me in the @~!£$.If there are issues, are there any work arounds? Many Thanks in advance  The .net Framework 3.0 and 3.5 add features to the .net framework 2.0 so installing the additional framework should not cause any pro...

Cannot get CheckSetup to complete on Windows XP using Bugzilla 3.0 and MySQL 5.0
All - I am having trouble getting to complete. I am getting the following error message when I run I tried all of the suggested fixes. Any help would be much appreciated. D:\bugzilla-3.0> * This is Bugzilla 3.0 on perl 5.8.8 * Running on WinXP/.Net Build 2600 (Service Pack 2) Checking perl modules... Checking for CGI (v2.93) ok: found v3.20 Checking for TimeDate (v2.21) ok: found v2.22 Checking for DBI (v1.41) ok: found v1.52 Checking for PathTools (v0.84) ok: found v3.12 Ch...

Problem with Linq to XML in .net 3.5 project (previously converted from .net 2.0)
 Hi!I'm experiencing some problems with Linq to XML in .net 3.5 and I hope someone will be able to help me. I have the following code: 1 XDocument xml = XDocument.Load(FileUpload1.PostedFile.FileName);2 3 4 int no_of_rows = xml.Root.Descendants("{}tr").Count();5 6 int no_of_cells = xml.Root.Descendants("{}tc").Count();7 8 int no_of_columns = (no_of_cells/no_of_rows);9 ...

Web resources about - How to get datasource name dynamically from .txt / .xml file using 2.0 with Mysql 5.0 -

Placebase team at Apple file “Schematic Maps” patent dynamically detailing important data
In a report from Computerworld way back in 2009, we learned that Apple had quietly acquired Maps API company Placebase. Then, founder of Placebase ...

Apple's Lightning port dynamically assigns pins to allow for reversible use
... a closer look at how Apple's new Lightning connector works, and has come to the conclusion that the 8 pins on each side of the plug are dynamically ...

In a dynamically typed language, is it a bad idea to return different data types?
In some cases, returning different types from a single function works.

Urlbox Launches Screenshots-as-a-Service Platform to Dynamically Update Galleries
... changes. Launched yesterday, Urlbox allows anyone with a gallery displaying website screenshots to automate the process and keep them dynamically ... launcher dynamically adapts to what you’re doing right now
... phone according to what you’re doing. Perform a search for ‘football’ and your background will change to the NFL logo. A launcher that dynamically ...

A YouTube Experiment Resizes the Player Dynamically
There's a new YouTube experiment that changes the video player's size, depending on the browser window's size. When resizing Chrome's window, ...

Apple Granted “Dynamically Changing Cursor for User Interface” Patent, Originally Filed in 2003
... a utility patent that covers the use of the mouse cursor that changes according to the context of the task it is engaged in. Called a “Dynamically ...

Atmel's FPSLIC II Dynamically Reconfigurable SoC Supports "Silicon-Sharing" For Peripherals & Interfaces ...
Silicon-Sharing Fits 200K Gate Design into 40K Gate FPSLIC II's, Cuts Power Drain by 97% Launcher Wants to Dynamically Change Phones Based on Location, Interests, and Mental State ...
What if your phone’s launcher dynamically changed based upon interests, your location, or topics you had in mind at a specific moment? A new ...

Resources last updated: 12/7/2015 5:34:09 AM