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

Reading connection string from my App.Config file


This is my first post to this group. I just want to ask that how will I read
my connection string from the app.config file in C# 2008 and .Net 3.5. I
tried to use System.Configuration namespace but I think missing something.

here is my app.config file

<?xml version="1.0" encoding="utf-8" ?>
name="Containers.Properties.Settings.Custom_JobCon nectionString"
connectionString="Data Source=;Initial
Catalog=Custom-Job;User ID=sa;Password=altsds"
providerName="System.Data.SqlClient" />

Thanks in Advance
Abul Hasan Lakhani.
Jul 3 '08 #1
2 6438
On Wed, 02 Jul 2008 22:03:55 -0700, Abul Hasan Lakhani
This is my first post to this group. I just want to ask that how will I
my connection string from the app.config file in C# 2008 and .Net 3.5. I
tried to use System.Configuration namespace but I think missing
If you're just using the project's Properties to store the string, then
you can access the string via the Properties.Settings.Default property for
your project.

If you're not storing the connection string that way, then you should be.
Otherwise you have to use the ConfigurationManager directly, which is a
pain (well, at least compared to using the Designer-provided Settings
class :) ).

Jul 3 '08 #2
Hi Abul,

You need some sort of System.Configuration.ConfigurationManager.Connecti onStrings["Containers.Properties.Settings.Custom_JobConnecti onString"]
Regards, Alex Meleta
mailto:am*****@gmail.com; blog:devkids.blogspot.com
Jul 3 '08 #3

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

Similar topics

by: Jon Davis | last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms designer and seeing a SqlDataAdapter automatically created for me.. being able to create a DataSet from that is fun and...
by: news.microsoft.com | last post by:
Hi After conducting a several searches, I wasn't sure where to post this question. So my apologiesbefore hand for double posting this and possibly posting to the wrong forum(s). Okay, I have...
by: WebMatrix | last post by:
Hello, I have developed a web application that connects to 2 different database servers. The connection strings with db username + password are stored in web.config file. After a code review,...
by: Matt Colegrove | last post by:
I'm working on a web app that is published to a hosting service. I'm developing it on my local PC with VS 2005 and SQL Express. The hosting service DB is SQL Server 2000. I have two...
by: Ryan | last post by:
I've created a custom configuration section that inherits (naturally) from System.Configuration.ConfigurationSection. The configuration section is working 99% fine, however I keep coming across a...
by: Brad Pears | last post by:
I want to have my SQL Server 2000 database connection string data in an .ini file or a .xml file and then read that string into my vb.net 2005 app - rather than hard code the connection string in...
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...
by: Thorsten Dittmar | last post by:
Hi, I don't get it. I'm using a typed dataset with table adapters and all that stuff. I have the database server running locally on my development system. Now: when creating a tableadapter...
by: Brett | last post by:
I wrote an ASP.NET application that queries a SQL Server database (on a different box from the web server) and displays the result in a GridView. The datasource for the GridView is a SQLDataSource....
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...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
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...
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,...
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...

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.