Click here to Skip to main content


QuestionApp.Config PinmemberAduu11-Nov-12 14:52 
Hi, I am trying to access a MS Access database using Windows form. I added my connection string in App.congig file.
 <?xml version="1.0" encoding="utf-8" ?>
    <add name="Constr" providerName="System.Data.OleDb" 
         connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\XXXX\\Documents\\YYYYY.accdb; Persist Security Info=False;"/>
Code I added in my code to read this is
string  connectionstring = ConfigurationManager.ConnectionStrings["Constr"].ConnectionString;

but I am getting following error on this line.
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
I am not getting why I am getting this error. Can anyone please help me out in this. I am new in this functionality.
QuestionRe: App.Config [modified] PinmemberSuper Lloyd11-Nov-12 17:23 
AnswerRe: App.Config Pinmemberryanb3112-Nov-12 6:30 
AnswerRe: App.Config PinmemberSimon_Whale12-Nov-12 6:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Mobile
Web02 | 2.8.150224.1 | Last Updated 1 Mar 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid