PC Review


Reply
Thread Tools Rate Thread

Connection String in c#.net

 
 
Atul Rane
Guest
Posts: n/a
 
      8th Oct 2008
I am declareing my connection string in web.config file like that ;

<connectionStrings>
<add name ="SQLConnectionString" connectionString ="Persist Security
Info=False;User ID=sa;password=P@ssw0rd;Initial Catalog=Aperio;Data
Source=OPTRA-2003"/>
</connectionStrings >

Know i want to access this connection string in my Class.
How i can get this connection string in my Class.
I added reference System.Configuration but still i am unable to get
ConfigurationManager.ConnectionString[""].connectionstring.
 
Reply With Quote
 
 
 
 
Peter Morris
Guest
Posts: n/a
 
      8th Oct 2008
01: Add System.Configuration.dll to your references
02:
string cs =
System.Configuration.ConfigurationManager.ConnectionStrings["SQLConnectionString"];



--
Pete
====
http://mrpmorris.blogspot.com
http://www.capableobjects.com


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a connection object (sql/oledb/odbc) based on connection method/string. Hetal Microsoft VB .NET 2 30th Apr 2007 05:55 PM
Query String or Connection String with Regex jwgoerlich@gmail.com Microsoft C# .NET 3 11th Jan 2007 09:55 AM
Connection String question - accessing one string throughout solut =?Utf-8?B?Z2FyeSBnLg==?= Microsoft Dot NET 2 26th Apr 2006 06:48 PM
Connection String object Convert to String Variable Type =?Utf-8?B?TWlrZSBNb29yZQ==?= Microsoft ASP .NET 2 26th Oct 2004 03:43 PM
connection string exception : Format of the initialization string does not conform to specification starting at index 0 Gaurav Microsoft ASP .NET 0 7th Nov 2003 10:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:43 AM.