Click here to Skip to main content
13,045,540 members (71,972 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dear Friends

I have add a config file to my window form and trying to calling that through my button click with following query..

SqlConnection con = new SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

but it is showing Error for ConnectionManager. I have also include Using System.Configuration in form.

Please help me I have Vistual Studio 2010

Posted 25-Jan-13 0:09am
Updated 25-Jan-13 0:10am
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

If you are seeing this issue and it's a compilation error, I can pretty much guarantee that you haven't added the reference to System.Configuration.dll. A lot of people seem to think that the configuration manager works from the references you get by default in a VS project.

If you expand your References in the solution explorer, you should see that this file is missing. To fix it, add the reference to System.configuration by right clicking on the References node and select Add reference... to open the reference dialog.

If, however, it's a runtime error, I would suspect that you don't have a connection string named ConnectionString in your config file. This would result in a null exception when you tried to get the ConnectionString property from the configuration.

By the way - when you say you have an error, it's generally a good idea to say what the error actually is. Is it a runtime error? Is it a compilation error?
aspnet_regiis -i 30-Jan-13 6:06am
This is the correct answer. The System.Configuration dll reference has to be added. +5
Pete O'Hanlon 30-Jan-13 8:05am
Thanks. I suspect that sisir patro has downvoted it because I pointed out the errors in his answer:)
aspnet_regiis -i 30-Jan-13 8:18am
I agree with your suspicion....I think this guy Sisir patro is insane.. He downvoted my simple and correct answer here .. I am reporting this user as abusive
aspnet_regiis -i 30-Jan-13 8:33am
Pete ! The solutions to this question are deleted.. Any idea how?
Pete O'Hanlon 30-Jan-13 9:10am
Click on the title of the question - it's a hyperlink - it will reopen the question with the answers present again. It did this for me before.
aspnet_regiis -i 30-Jan-13 9:19am
Thanks for the tip..It worked for me.. One more thing..You should check this link ^
Pete O'Hanlon 30-Jan-13 11:55am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

VS2008 will only show the Config manager if the solution node is visible in the Solution Explorer.

If you only have a single project, the solution will not show hence you can't see the config manager.

To solve this, make sure the following option is checked.

Tools|Options|Projects and Solutions|General|Always Show Solution

This user took this information from DaveL's answer to this[^] question in StackOverflow. Full credit goes to the problem solver on Stack Overflow.

Edited by Peter O'Hanlon in response to comment about poster plagiarising work.
Milind_T 25-Jan-13 6:35am
Copy - Paste ? Who is "Timwi"
pranathis012 27-Jan-13 23:24pm
yes dear, i just simply do copy and paste only , but before that why r u not answering this question...?. I don't no the exact answer , but my intensity is to help to others that's way i search in google and answer that question..., i'm not excepting voting , i'm not participating any debat contest...? right . I don't no this is the exact solution or not but when i search in google this answer also available i'm checking with my PC this works fine for me, that's way i post that answer. If you know the answer ..,i'm asking you why are you not posting the answer..?. Everybody comment to others , but no one resopnd in proper way why..? this is your professionality...?
Marcus Kramer 28-Jan-13 11:22am
Professionality? Professionals show a link to where they find the answer. Plagiarism is taking credit for someone else's work, which is what you have done here. It is fine to copy/paste an answer from somewhere else, BUT you need to provide a link to that source so that credit is provided to the original source.
pranathis012 29-Jan-13 4:59am
In that link having bulk of data so, in that i'm selecting few lines only. how the end user know which line is exact satisfy the requirement.

Plagiarism is taking credit for someone else's work, which is what you have done here, i'm not expecting any one complements... k,

my intensity is, my answer is solve the user problem or not, that's enough...

if you think in wrong direction that's not an issue ..

i'm asking you if you know the answer why are you not respond this question...?

why because you spend a time for complements....

but i'm not expecting any complements....

professionality means not only in subject wise , the way we are thinking, the way we are accepting the other persons suggestions... it's depending upon the way we behave in social networks
Marcus Kramer 29-Jan-13 10:03am
In this community, plagiarism is using ANYONE's work from ANYWHERE without giving credit. Is it really that hard to add a link to where you copied the information from? I don't think so and it is the proper, professional way to do this. Your profile indicates that you are a junior developer. I would suggest you take the advice of someone who has been around for quite a while. Give credit where credit is due.
Pete O'Hanlon 29-Jan-13 10:24am
Actually, your copy and paste is technically incorrect. The poster asked about VS 2010 and you stole the answer to a question about VS 2008. In future, if you steal someone else's work, at least provide a link to that original work - failure to do so will see you banned from the forums.
Marcus Kramer 25-Jan-13 12:51pm
Plagariasm... Source
Sergey Alexandrovich Kryukov 29-Jan-13 13:53pm
Tried to report, but bad guy already gone. We should not let such things pass.
Thank you very much.
Sergey Alexandrovich Kryukov 29-Jan-13 13:55pm
Did you see the unique case of same-page plagiarism I reported?
Marcus Kramer 29-Jan-13 14:05pm
I did and I left a comment to that user as well. I didn't want that message to be visible to everyone so I posted the comment so they would get notified with it, but then removed it.
Sergey Alexandrovich Kryukov 29-Jan-13 15:52pm
I understand. Maybe I missed you message somehow...
Thank you,
Marcus Kramer 29-Jan-13 16:42pm
I removed it right after posting it so the OP would receive it and no one else would see it. It's an easy way to send a "private message".
Sergey Alexandrovich Kryukov 29-Jan-13 17:04pm
Ah, OP. I thought you were talking about the message sent to myself...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100