Re: Null Exception Error Using connection string in app.config
Go to your project properties, under the settings table there will be a grid with Name, Type, Scope and value. Make sure your setting is listed as
Code:
Name Type Scope Value
MyData (ConnectionString) Application Provider=Microsoft.Jet.Oledb.4.0;Data Source=MyData.mdb;Jet OLEDB:Database Password=123456789
That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma
Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney
Re: Object reference not set to an instance of an object
I checked my settings but still having no luck.
I've been playing with this on and off for a week and still cant get it to work.
I've created a new test project and still having the same issues
I'm receiving the error
Object reference not set to an instance of an object
Form1:
vb Code:
Imports System.Configuration
Imports System.Data.OleDb
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim Test As String
Dim con As New OleDbConnection
Dim str As String = ConfigurationManager.ConnectionStrings("DB").ConnectionString
and the name is WindowsApplication1.My.MySettings.DB and you are trying to find a name called "DB" which is causing the issue. Change the WindowsApplication1.My.MySettings.DB to DB in config file
Please mark you thread resolved using the Thread Tools as shown