Thursday, December 22, 2011

How To - Get connection string from web.config in ASP.NET

Sample web.config



  
  


Get Connection string at runtime

In order to retrieve a specific connection string from the web.config, first we need a reference to System.Configuration. In .NET 4, the reference has already been added for us, but we still need to add "using System.Configuration;" in our page. In previous .NET versions, you needed to add the reference manually by going to the references folder in the solution explorer, right click and select Add Reference. From the .NET tab, select System.Configuration. After having done the above, we can get the connection string required by using the following code.
private const string CONNECTIONSTRING_NAME = "LocalSqlServer";
string myConnectionString = ConfigurationManager.ConnectionStrings[CONNECTIONSTRING_NAME].ConnectionString;

Using connection string expression syntax

We can bind the connection string directly to the connection string property of the sqldatasource using ASP.NET expressions. This is done by using the following syntax




102 comments:

  1. Thanks for penning high-grade contents what you actually
    share here is valuable and remarkable for revisiting looking forward for the
    next write-up.

    www.joeydavila.net

    ReplyDelete
  2. I really enjoyed reading your article. I found this as an informative and interesting post, so i think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article.


    edupdf.org

    ReplyDelete
  3. Those look interesting. Keep posting.

    chester
    www.imarksweb.org

    ReplyDelete
  4. Hi i have found such great blog here i hope it will helpful for you thanks for sharing.
    greengeeks coupon

    ReplyDelete
  5. The scores could additionally affect the circulation of newsfeed and also chart search which is a new element for marketing experts to think about. Where To Buy Pinterest Followers

    ReplyDelete
  6. Get a wide range of packing and moving companies at helloenquiry.in. We endeavour to furnish the best packers and movers companies in your city at ease of Internet. Packers and Movers Bangalore

    ReplyDelete
  7. I really enjoyed reading your blog, you have lots of great content.Please visit here:
    http://packersmoversahmedabad.co.in/
    Ahmedabad Packers And Movers is recognized as a business manager providing wide-ranging and differentiate service appearance as well as Relocation Shifting, Logistics and Transportation, Facilities managing, strategy & Designing services.

    ReplyDelete
  8. Packers Movers Bangalore amenable and kind administration individual take care of customer's enthusiasm for pressing and transporting and give them as per their bolster and hobby. This is for to meet their individual requests as every one have an alternate safe place. With the yearning to be "THE BEST" Packers Movers Bangalore productively constant frequently work to keep up the tag. What's more, henceforth ruling out grumblings.
    http://packersmoversbangalore.in/packers-and-movers-ahmedabad
    http://packersmoversbangalore.in/packers-and-movers-hyderabad
    http://blog.packersmoversbangalore.in/

    ReplyDelete
  9. People have to sustain their kitchen position place position items more purposely, since it allows them a lot for cooking and providing the foods so they should adhere to the several factors while cleaning and cleaning the factors. Packers and Movers in Bangalore
    Packers and Movers in Pune
    Packers and Movers in Hyderabad
    Packers and Movers in Mumbai

    ReplyDelete
  10. Extreme attention must be put towards the cleaning of the desk ware places and after cleaning, it has to be desiccated. Packers and Movers in Chennai
    Packers and Movers in Delhi
    Packers and Movers in Gurgaon
    Packers and Movers in Noida

    ReplyDelete
  11. I must say you had done a tremendous job,I appreciate all your efforts.Thanks alot for your writings......Waiting for a new 1...Please visit our wonderful and valuable website-http://packersmovershyderabadcity.in/
    http://blog.packersmovershyderabadcity.in/
    http://packersmovershyderabadcity.in/packers-and-movers-anantapur
    http://packersmovershyderabadcity.in/packers-and-movers-vizianagaram

    ReplyDelete
  12. Generally I don’t read article on blogs, but I would like to say that this write-up very compelled me to take
    a look at and do so! Your writing style has been amazed me.
    Thank you, very great post.
    Please visit our wonderful and valuable website-
    http://packersmoverschennai.in/
    http://packersmoverschennai.in/packers-and-movers-indian-institute-of-technology-chennai

    ReplyDelete
  13. Thanks you for sharing this informative and useful article.Really interesting and awesome article.
    Please Visit Our Webpage: http://packersmoversahmedabad.co.in/
    http://packersmoversahmedabad.co.in/packers-and-movers-jamnagar-gujarat
    http://packersmoversahmedabad.co.in/packers-and-movers-kutch-gujarat
    http://packersmoversahmedabad.co.in/packers-and-movers-mehsana-gujarat
    We are expert in Handling, Movers Packers in Ahmedabad and Packing & Shifting of Household Goods, Office goods, Commercial Equipment and Car, Logistics and Transportation. Packers And Movers Ahmedabad

    ReplyDelete
  14. I appreciate from this post and its seems looking so informative ad networks for good target for Indian's. Thanks for sharing with us..
    Packers And Movers Bangalore
    Packers And Movers in Bangalore

    ReplyDelete
  15. Packers and Movers Delhi designate you a simple of covering the administrations like family/private moving, office exchanging, products moving , stacking and emptying, and so on most importantly if there should arise an occurrence of delay additionally we give you the office of warehousing your extensive measure of merchandise. Whether deferral is from your side or from our side or because of any normal catastrophe we are in charge of the wellbeing and security of your profitable stock for a week prior and then afterward the enrolled dates of migration to us.
    http://packers-and-movers-delhi.in/
    http://packers-and-movers-delhi.in/packers-and-movers-patel-nagar-delhi

    ReplyDelete
  16. Packers and Movers Kolkata list up the leading #packers and #Movers Company for you to choose best among reputed companies in moving industry. They offer Packers And Movers services Kolkata at your doorstep helping you with shifting #household items, #office relocation, furniture, machinery and equipment, industrial goods, etc. Besides shipping of household goods, Packers And Movers in Kolkata provide modern facilities like warehouse shifting. Our experienced and skilled professional labors are trained to expertise the shifting process without any disturbance and inconvenience to the customer. So as to make their shifting hassle free.
    http://blog.kolkatapackersmovers.in/
    http://kolkatapackersmovers.in/packers-and-movers-customs-house-kolkata

    ReplyDelete
  17. hey,nice blog i must say u had done a tremendous job here thanks for all the efforts you made.
    Please visit our official website for necessary information we provided-http://packersmoverschennai.in/
    http://packersmoverschennai.in/sitemap
    Packers And Movers Chennai

    ReplyDelete
  18. Get a wide range of packing and moving companies at helloenquiry.in. We endeavour to furnish the best packers and movers companies in Gandhinagar at ease of Internet. Packers and Movers Gandhinagar

    ReplyDelete
  19. MOVERS AND PACKERS IN BANGALORE regard your sentiments and know the feelings of yours associated with the advantages thus to ensure the well-being and security of your associations is our uttermost need. Therefore we list only the skilled and sound departure workplaces with us. Our organizations are not compelled here just, we outfit you with the free question shape so you can get free relocation refers to from the top packers and movers of your city with a single structure. This is the thing that we and our working methodologies is about, your convenience and your satisfaction.
    http://packers-and-movers-bangalore.in/

    ReplyDelete
  20. Izin share ya, semoga sukses:
    http://obatglaukoma.utamakansehat.com/
    http://obatnyerisendi.utamakansehat.com/
    http://obattbckelenjar1.utamakansehat.com/
    http://obatkuatbercinta.greenworldglobals.com/
    http://obatamandel.utamakansehat.com/
    http://pengobatandarahtinggi.greenworldglobals.com/
    http://obatususbuntu.utamakansehat.com/
    http://obathernia.utamakansehat.com/

    ReplyDelete
  21. Thanks for sharing useful information for us.I really enjoyed reading your blog, you have lots of great content.Please visit here:
    http://packersmovershyderabadcity.in/
    Hyderabad Packers And Movers is recognized as a business manager providing wide-ranging and differentiate service appearance as well as Relocation Shifting, Logistics and Transportation, Facilities managing, strategy & Designing services.thanks a lot for all your efforts...
    Packers And Movers Hyderabad

    ReplyDelete
  22. Thanks for sharing useful information for us.I really enjoyed reading your blog, you have lots of great content.Please visit here:
    http://packersmovershyderabadcity.in/
    Hyderabad Packers And Movers is recognized as a business manager providing wide-ranging and differentiate service appearance as well as Relocation Shifting, Logistics and Transportation, Facilities managing, strategy & Designing services.thanks a lot for all your efforts...
    Packers And Movers Hyderabad

    ReplyDelete
  23. I really enjoyed reading your blog, you have lots of great content.Please visit here:
    http://jaipurpackersandmovers.in/
    http://jaipurpackersandmovers.in/packers-and-movers-alwar
    We are expert in Handling, Movers And Packers Jaipur and Packing & Shifting of Household Goods, Office goods, Commercial Equipment and Car, Logistics and Transportation.

    ReplyDelete
  24. I really enjoyed reading your blog, you have lots of great content.Please visit here:
    http://packersmoversmumbaicity.in/
    Packers And Movers is recognized as a business manager providing wide-ranging and differentiate service appearance as well as Relocation Shifting, Logistics and Transportation, Facilities managing, strategy & Designing services.

    ReplyDelete
  25. An excellent information provided thanks for all the information i must say great efforts made by you.
    thanks a lot for all the information you provided.
    please visit our official website for further details-
    http://kolkatapackersmovers.in/
    http://kolkatapackersmovers.in/packers-and-movers-hooghly

    ReplyDelete
  26. To get best Packing and Shifting service at affordable price Visit
    http://www.expert5th.in/packers-and-movers-manesar/
    http://www.expert5th.in/packers-and-movers-agra/
    http://www.expert5th.in/packers-and-movers-bhatinda/
    http://www.expert5th.in/packers-and-movers-bikaner/
    http://www.expert5th.in/packers-and-movers-pathankot/
    http://www.expert5th.in/packers-and-movers-hisar/
    http://www.expert5th.in/packers-and-movers-panipat/
    http://www.expert5th.in/packers-and-movers-sonipat/
    http://www.expert5th.in/packers-and-movers-rajkot/
    http://www.expert5th.in/packers-and-movers-surat/
    http://www.expert5th.in/packers-and-movers-vadodara/
    http://www.expert5th.in/packers-and-movers-kurukshetra/
    http://www.expert5th.in/packers-and-movers-jamnagar/
    http://www.expert5th.in/packers-and-movers-varanasi/

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. This comment has been removed by the author.

    ReplyDelete
  30. Your website content is fabulous and awesome but I would like to say your website also good.
    Thanks for sharing... Keep it up..
    http://packersmoverschennai.in/packers-and-movers-tuticorin-thoothukudi-tamilnadu
    http://packersmoverschennai.in/packers-and-movers-tuticorin-thoothukudi-tamilnadu
    http://packersmoverschennai.in/packers-and-movers-tiruchirappalli-tamilnadu
    With the many years of experience in supporting people with this requirements and colossal assortment of packers and movers organizations Chennai, we require push to invest you with the better choices. In this way, how about we come us and get help with the best help.
    Packers And Movers Chennai

    ReplyDelete
  31. Best packers and movers in Ahmedabad, household shifting service in Ahmedabad, home relocation in Ahmedabad, car carriers service in Ahmedabad, car transport in Ahmedabad. packers and movers Ahmedabad

    ReplyDelete
  32. Really impressive post. I read it whole and going to share it with my social circules. I enjoyed your article and planning to rewrite it on my own blog.
    Packers And Movers Bangalore

    Packers And Movers in Bangalore

    ReplyDelete
  33. I admire the valuable advice you make available in your expertly written content. I want to thank you for this informative read; I really appreciate sharing this great.
    Packers And Movers Pune
    Packers And Movers Nigdi Pune
    Packers And Movers Chinchwad Pune

    ReplyDelete
  34. Your website content is fabulous and awesome but I would like to say your website also good. Thanks for sharing... Keep it up..
    http://packersmovers.top/chennai/
    http://packersmoverschennai.in/
    Packers And Movers Pudukkottai Tamilnadu
    Packers And Movers Ramanathapuram Tamilnadu
    Packers And Movers Salem Tamilnadu
    Packers And Movers Sivaganga Tamilnadu

    ReplyDelete
  35. Design of data your shared is pretty simple and a decent easy to understand interface. Experience is essential in each industry. We have great involvement in packing, shifting and moving the merchandise according to our client's craving and needs. Packers And Movers Bangalore
    Packers And Movers Hampinagar
    Packers And Movers JP Nagar
    Packers And Movers Doddakallasandra

    ReplyDelete
  36. manufactured by RDK Global.The average person taking Phen375 once a day loses 3-5 pounds in a single week.That’s over a pound every 48 hours! Another Phen375 advantage is that it does not stop its action after 3 months. You may take it as long as you need it.For More Information Visit: http://www.dietreviewmonster.com/phen375

    ReplyDelete
  37. Thanks for providing such a helpful information
    Very nice I like a lot of these topics, it was part of my area.

    Packers Movers Indore
    Packers And Movers Bhanwrasala Indore
    Packers And Movers Bhatkhedi Indore

    ReplyDelete
  38. An excellent information provided thanks for all the information i must say great efforts made by you.
    thanks a lot for all the information you provided.
    please visit our official website for further details-
    Packers And Movers Jaipur

    ReplyDelete
  39. I must say you had done a tremendous job,I appreciate all your efforts.Thanks alot for your writings......Waiting for a new 1.. We Provide Best Packers And Movers Bangalore List for Get Free Best Quotes, Compare Charges, Save Money And Time,
    Household Shifting Services. @ Packers And Movers in Bangalore

    ReplyDelete
  40. I enjoy most of your articles,the articles are so nice for readers.

    www.gofastek.com

    ReplyDelete
  41. Breast Actives
    is a 3 step all natural solution for breast enlargement, combining breast pills, cream and a breast exercise and massage program.http://www.breastactivesbuy.com/

    ReplyDelete
  42. The blog or and best that is extremely useful to keep I can share the ideas. Age Of War 2
    Big Farm | Slitherio | Tank Trouble
    Of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    Happy Wheels | Goodgeme Empire | Slither.io

    ReplyDelete
  43. This information must read once by each and everyone because its essential for all.
    thanks admin for your updated and very nice post always.
    Download CinemaBox

    ReplyDelete
  44. There are many low standards and inexperience shifting are also available in few costs which is not perfect for people who want to shift in Delhi or across the country. You have to avoid the inexperience moving companies for better stuffs and easier and smooth relocation from one place to another place
    Packers and Movers in Delhi
    Movers and Packers in Delhi
    Packers and Movers Delhi
    Movers and Packers Delhi

    ReplyDelete
  45. The most in demand online social network site Twitter helps people to realize about ongoing issues and activities or social reactions of their favored superstars. buy twitter followers cheap

    ReplyDelete
  46. Buy YouTube subscribers. This is the popular approach for boosting the Google authority. To discover more keep examining this article. buy youtube subscriber

    ReplyDelete
  47. So it is worthwhile for buying twitter followers as a secret formula to become well known.
    buy twitter followers

    ReplyDelete
  48. No more longing to become widely known at this time. Buy Facebook Followers as a strategy to acquire status and authority on the internet in a shorter span. buy facebook followers

    ReplyDelete
  49. THANKS FOR INFORMATION AND PERMISSION SHARE http://gamatori.com -- Terima kasih izin ngeshare ya http://gamatori.com

    ReplyDelete
  50. Have you been hunting for valid real YouTube Views? Forget your worries, we can diligently help you to buy YouTube Views. buying youtube subscribers

    ReplyDelete
  51. Presently, it has turned out to be simple for the QuickBooks clients to connect all your bank subtle elements with QuickBooks and gives a simplicity while making exchanges from Mastercard or from any bank. While any interference like idle financial balance, card not working or changes in record can without much of a stretch be taken with the assistance of specialized hands Quickbook Technical Support Number 1888-396-0208.

    ReplyDelete
  52. Life-time Replacement is something which you barely find, as you Buy facebook reviews. Only a few excellent suppliers are offering this. buy usa facebook reviews

    ReplyDelete

  53. Manish Packers and Movers Pvt Ltd as a Services providing company can make all the difference to your Home Relocation experience. Indore based Company which offers versatile solutions, Right team that easily reduce the stress associated with a Household Shifting, Vehicle Transportation. we help things run smoothly and reduce breakages and offer you seamless, Affordable, Reliable Shifting Services, Compare Shifting Charges, Visit :
    https://www.manishpackersmoversindore.in/
    https://www.manishpackersmoversindore.in/packers-and-movers-indore.html
    https://www.manishpackersmoversindore.in/manish-packers-and-movers-indore.html
    https://www.manishpackersmoversindore.in/packers-movers-gurgaon.html
    https://www.manishpackersmoversindore.in/packers-movers-kolkata.html
    https://www.manishpackersmoversindore.in/packers-movers-mumbai.html
    https://www.manishpackersmoversindore.in/packers-movers-bhopal.html
    https://www.manishpackersmoversindore.in/packers-movers-nagpur.html
    https://www.manishpackersmoversindore.in/packers-movers-raipur.html
    https://www.manishpackersmoversindore.in/packers-movers-ahmedabad.html

    ReplyDelete
  54. It’s really a cool and helpful piece of info. I am happy that you simply shared this helpful
    info with us. Please stay us up to date like this.
    Thanks for sharing.

    https://bit.ly/2oITVef | https://bit.ly/2wPdrsW | https://bit.ly/2wS8AXX

    ReplyDelete
  55. Numerous Quickbooks client have absence of information about like how to utilize it, by what means can chip away at it, by any stretch of the imagination. Quickbooks Enterprise 24x7 Support Number 1888-557-6950 help you to determine all sort of specialized issue right away.

    ReplyDelete
  56. Packers and Movers Indore - Call 09303355424, Local Household Shifting in Indore, Domestic Home Relocation from Indore. International Home Relocation from Indore, Office Shifting within Indore, Car and Bike Transportation from Indore, Safe Packing and Moving Services,
    Packers and Movers Indore
    Packers and Movers Gurgaon
    Packers and Movers Kolkata
    Packers and Movers Mumbai
    Packers and Movers Delhi
    Packers and Movers Jaipur
    Packers and Movers Raipur
    Packers and Movers Pune
    Packers and Movers Ahmedabad
    Packers and Movers Indore Blog

    ReplyDelete
  57. Packers And Movers Bangalore Local Household Shifting Service, Get Free Best Price Quotes Local Packers and Movers in Bangalore List , Compare Charges, Save Money And Time.
    Packers And Movers in Bangalore

    ReplyDelete
  58. Thanks for a nice share you have given to us with such an large collection of information.
    Great work you have done by sharing them to all.
    simply superb.construction company in bhopal
    Best Builders in bhopal
    Plots in Bhopal
    singlex, Duplex houses in bhopal
    coloniser in bhopal
    real estate developers in bhopal

    ReplyDelete
  59. intuit data protect is a subscription service that helps you protect your data from loss or damage due to virus, laptop theft, file corruption, fire, and so on. Your files are automatically backed up online over the Internet once a day, every day, at an automatically selected time to an offsite location. You can choose to back up just your QuickBooks file, or you can back up multiple QuickBooks files and any other data on your computer.

    ReplyDelete
  60. QuickBooks accounting software created a benchmark in the area of accounting & bookkeeping. In the past few years, the demand for this software increased so much that the Intuit has to double the productivity. In this post, we are going to discuss the quickbooks error code 80029c4a. This informative post includes topics like its causes & resolution.However, if the error code persists – you can contact the certified QuickBooks technicians of QuickBooks Error Support. Or you can get in touch with them by making a call on their toll-free number .i.e. +1(800)396-7703.

    ReplyDelete
  61. Thank you for sharing such beautiful information with us. I hope you will share some more information about packing and moving. Please keep sharing. Packers and movers.
    Cheapest packers and movers in Kolkata
    packers movers in parnasree Kolkata
    House shifting services in Kolkata
    Office shifting services
    Packers movers services, professional packers

    ReplyDelete