ConnectionStrings in web.config configuration file – Part 3

Published by admin on



C#, SQL Server, WCF, MVC and ASP .NET video tutorials for beginners

In this video session we will learn about
1. Storing connection strings in a configuration file. For example, web.config for an asp.net web application and app.config for windows application
2. Reading the connection strings from web.config and app.config files.
3. Disadvantages of storing connection strings in application code.
4. Advantages of storing connection string in configuration files – web.config and app.config.

source


32 Comments

Tim W · July 13, 2018 at 6:57 am

Awesome work!

shivani singh · July 13, 2018 at 6:57 am

Sir connection krne pr error aa rahi hai

Shweta Sahu · July 13, 2018 at 6:57 am

Thanks for the video .. it is very helpful 🙂

Nazar hussain · July 13, 2018 at 6:57 am

Brother u have done a great service to all of us students…Allah Bless U.

Musleh haj · July 13, 2018 at 6:57 am

Thanks for this valuable information
sir can we do same technique in VB.net while using master ASPX page?

Radhika Ganji · July 13, 2018 at 6:57 am

hai Sir ,Learned so many things from Your video's,So many Thanks .

Jahirul Islam Monir · July 13, 2018 at 6:57 am

I am so happy sir.. I learned a lot from Ur great explanation.. Thanks for Ur great priceless service… You booked a place in my heart sir… And again Thank you sooooooooooooo much……

Bigyan Chapagain · July 13, 2018 at 6:57 am

Awesome Tutorial. But its old. Do have any recent one on the same topic?

amar mathur · July 13, 2018 at 6:57 am

Hi sir,
I have learned lots of c# concepts from your videos.
I want to know how to read custom section from web config file in c#.
My custom section contain nested nodes (not key value pair).
I have already read it using StreamReader class but when I create SqlConnection then it gives exception like "Bad configuration in web config". Please help me.

Prashanth Olekar · July 13, 2018 at 6:57 am

Good Job Sir..thank you so much

Esteban Quijada Suazo · July 13, 2018 at 6:57 am

Thanks, for the job….

something Complicated · July 13, 2018 at 6:57 am

i m having problem typing configuration Manager

Saad Ebad · July 13, 2018 at 6:57 am

can anybody or sir venkat help me that my project have another layers so when i write connection string in web.config file which is present in main project (Entry layer) then connection string cannot access to the other layer …Please help me that how can i access connection string in web.config to the other layer?

wu king · July 13, 2018 at 6:57 am

Thanks a lot.

Krishna S · July 13, 2018 at 6:57 am

Well done with patience, proper explainations

romesh reddy · July 13, 2018 at 6:57 am

I got error connection obj will not accepted

Akash Jivtode · July 13, 2018 at 6:57 am

sir,
interviewer ask me if hacker hack the web.cong file to avoid this where we store connection string ..

Muntaha Liaqat · July 13, 2018 at 6:57 am

sir why im getting exception……. i did everything like you too……im geting at ConnectionString; everything is same……. i just figure it out….
this is the code in windows form:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["studentDb"].ConnectionString); {here im getting error}
SqlCommand cmd = new SqlCommand("SELECT * FROM [Sample].[dbo].[tblCity]" , con);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
BindingSource source = new BindingSource();
source.DataSource = rdr;
dataGridView1.DataSource = source;
con.Close();
}
and my connection string is:
<connectionStrings>
<add name ="studentDb"
connectionString ="Data Source = .; initial catalog = Sample; Integrated Security=True; user id = sa ; password = 1234;"
providerName ="System.Data.SqlClient"/>
</connectionStrings>

Rifaqat Ullah · July 13, 2018 at 6:57 am

sir i need to know that when to close the connection. please kindly teach us in detail. please also teach us about connection pool and how does it become full.

Gagik Ohanyan · July 13, 2018 at 6:57 am

very good tutorials, thank you very much!!!

Johnson George · July 13, 2018 at 6:57 am

GOD BLESS YOU SIR

Masood Mirza · July 13, 2018 at 6:57 am

sir I want to learn error exception

1k fredo · July 13, 2018 at 6:57 am

I don't understand any thing what am I suppose to do when it's saids server error in rts application
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off". help please

Jasbir Singh · July 13, 2018 at 6:57 am

Thanks a lot sir venkat

Amit Gawade · July 13, 2018 at 6:57 am

simply great ..

Plam Ivanov · July 13, 2018 at 6:57 am

Connection String example…."Data Source=ServerNameInstanceName;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True"

this is for Windows Authentication,you need to escape "" with another "" of course

procopius · July 13, 2018 at 6:57 am

you're awesome

jsgovind · July 13, 2018 at 6:57 am

This channel is great for revising your basics. thanks a lot for the resources! 🙂

Abhishek Prasad · July 13, 2018 at 6:57 am

Thanks a lot Sir !!! The videos are awesome!

shah jahan blouch · July 13, 2018 at 6:57 am

thanks sir app too much great….

Slappin Tapes · July 13, 2018 at 6:57 am

Great tutorial! Very easy to comprehend and to follow as well.

Siddharth Vyas · July 13, 2018 at 6:57 am

an error occured datagridview1.databinding(); in vs 2013 their no func. databind() in vs 2013 what i do?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

en_USEnglish
en_USEnglish
%d bloggers like this: