Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Exception: The ConnectionString property has not been initialized

Reply
 
Old 04-03-2008   #1 (permalink)
Justin Doh


 
 

Exception: The ConnectionString property has not been initialized

Hello.
I had this error for a long time, and I need some help.

My program is a very simple System.Web.Mail program that calls a stored
procedure “spSendEmailNotification” and get data.
And based on the value that I get from the stored procedure, Web Mail is
sent of not.

Basically, I get this error when I execute an EXE file using Command Prompt:
“Exception: The ConnectionString property has not been initialized”

My first approach was looking at the Web.Config file.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Prod" value="server=SQL1;database=Prod;Integrated Security=SSPI"
/>

Or should I use this?? I am not sure what to add for the Password.. I just
guessed.

<add key="Prod" value="User ID=prod_group;Password=prod^group;data
source=SQL1;persist security info=True;initial catalog=Prod" />


After getting the error, I added the following lines inside <configuration>
at the Web.Config file inside <configuration> hoping that it would resolve
the error.

<connectionStrings>
<add name="Prod"
connectionString="Data Source=SQL1;Integrated Security=SSPI;Initial
Catalog=Prod;"
providerName="System.Data.SqlClient" />
</connectionStrings>



This is what is written at the business layer.

Public Function getEmailNotify() As DataSet
Return obj.GetData("spSendEmailNotification",
System.Configuration.ConfigurationSettings.AppSettings.Get("Prod"))
End Function


I would appreciate if anyone gives me some feedback.

Thanks in advance.



My System SpecsSystem Spec
Old 04-03-2008   #2 (permalink)
Norman Yuan


 
 

Re: Exception: The ConnectionString property has not been initialized

Simply do a debugging to see if the ConnectionString is actually loaded from
web.config or not:

Public Function getEmailNotify() As DataSet

''Place breakpoint HERE, to see what value "cn" gets, so you know the
setting is read in correctly ornot.
Dim cn As
String=System.Configuration.ConfigurationSettings.AppSettings.Get("Prod")

Return obj.GetData("spSendEmailNotification", cn)

End Function



"Justin Doh" <JustinDoh@xxxxxx> wrote in message
news:E0FDFBA3-F3B2-4441-9701-AFDBA8D494AF@xxxxxx
Quote:

> Hello.
> I had this error for a long time, and I need some help.
>
> My program is a very simple System.Web.Mail program that calls a stored
> procedure “spSendEmailNotification” and get data.
> And based on the value that I get from the stored procedure, Web Mail is
> sent of not.
>
> Basically, I get this error when I execute an EXE file using Command
> Prompt:
> “Exception: The ConnectionString property has not been initialized”
>
> My first approach was looking at the Web.Config file.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <appSettings>
> <add key="Prod" value="server=SQL1;database=Prod;Integrated Security=SSPI"
> />
>
> Or should I use this?? I am not sure what to add for the Password.. I just
> guessed.
>
> <add key="Prod" value="User ID=prod_group;Password=prod^group;data
> source=SQL1;persist security info=True;initial catalog=Prod" />
>
>
> After getting the error, I added the following lines inside
> <configuration>
> at the Web.Config file inside <configuration> hoping that it would resolve
> the error.
>
> <connectionStrings>
> <add name="Prod"
> connectionString="Data Source=SQL1;Integrated
> Security=SSPI;Initial
> Catalog=Prod;"
> providerName="System.Data.SqlClient" />
> </connectionStrings>
>
>
>
> This is what is written at the business layer.
>
> Public Function getEmailNotify() As DataSet
> Return obj.GetData("spSendEmailNotification",
> System.Configuration.ConfigurationSettings.AppSettings.Get("Prod"))
> End Function
>
>
> I would appreciate if anyone gives me some feedback.
>
> Thanks in advance.
>
>
My System SpecsSystem Spec
Old 04-03-2008   #3 (permalink)
Justin Doh


 
 

Re: Exception: The ConnectionString property has not been initiali

Actually, I am not sure whether it is still causing an error or not.

This is what is showing after debug.
At the end, it indicates "..has existed with code 0 (0x0)", but it still
shows the message "Exception: The ConnectionString property has not been
initialized" at the command prompt.
----------------------------------------------------------------------------------
'DefaultDomain': Loaded
'c:\winnt\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded.
'RootCause2': Loaded 'P:\My Documents\Work-others\Other
Misc\bin\RootCause2.exe', No symbols loaded.
'RootCause2.exe': Loaded
'c:\winnt\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50a3a\microsoft.visualbasic.dll', No symbols loaded.
'RootCause2.exe': Loaded
'c:\winnt\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll', No symbols loaded.
'RootCause2.exe': Loaded
'c:\winnt\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No
symbols loaded.
'RootCause2.exe': Loaded
'c:\winnt\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll', No symbols loaded.
'RootCause2.exe': Loaded
'c:\winnt\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll', No symbols loaded.
'RootCause2.exe': Loaded 'p:\my documents\work-others\other
misc\bin\libdata.dll', No symbols loaded.
The program '[1356] RootCause2.exe' has exited with code 0 (0x0).

I am not sure what is going on.
Any feedback is appreciated.

Thanks in advance.
Justin


"Norman Yuan" wrote:
Quote:

> Simply do a debugging to see if the ConnectionString is actually loaded from
> web.config or not:
>
> Public Function getEmailNotify() As DataSet
>
> ''Place breakpoint HERE, to see what value "cn" gets, so you know the
> setting is read in correctly ornot.
> Dim cn As
> String=System.Configuration.ConfigurationSettings.AppSettings.Get("Prod")
>
> Return obj.GetData("spSendEmailNotification", cn)
>
> End Function
>
>
>
> "Justin Doh" <JustinDoh@xxxxxx> wrote in message
> news:E0FDFBA3-F3B2-4441-9701-AFDBA8D494AF@xxxxxx
Quote:

> > Hello.
> > I had this error for a long time, and I need some help.
> >
> > My program is a very simple System.Web.Mail program that calls a stored
> > procedure “spSendEmailNotification” and get data.
> > And based on the value that I get from the stored procedure, Web Mail is
> > sent of not.
> >
> > Basically, I get this error when I execute an EXE file using Command
> > Prompt:
> > “Exception: The ConnectionString property has not been initialized”
> >
> > My first approach was looking at the Web.Config file.
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > <appSettings>
> > <add key="Prod" value="server=SQL1;database=Prod;Integrated Security=SSPI"
> > />
> >
> > Or should I use this?? I am not sure what to add for the Password.. I just
> > guessed.
> >
> > <add key="Prod" value="User ID=prod_group;Password=prod^group;data
> > source=SQL1;persist security info=True;initial catalog=Prod" />
> >
> >
> > After getting the error, I added the following lines inside
> > <configuration>
> > at the Web.Config file inside <configuration> hoping that it would resolve
> > the error.
> >
> > <connectionStrings>
> > <add name="Prod"
> > connectionString="Data Source=SQL1;Integrated
> > Security=SSPI;Initial
> > Catalog=Prod;"
> > providerName="System.Data.SqlClient" />
> > </connectionStrings>
> >
> >
> >
> > This is what is written at the business layer.
> >
> > Public Function getEmailNotify() As DataSet
> > Return obj.GetData("spSendEmailNotification",
> > System.Configuration.ConfigurationSettings.AppSettings.Get("Prod"))
> > End Function
> >
> >
> > I would appreciate if anyone gives me some feedback.
> >
> > Thanks in advance.
> >
> >
>
>
My System SpecsSystem Spec
Old 04-03-2008   #4 (permalink)
Justin Doh


 
 

Re: Exception: The ConnectionString property has not been initiali

I did not debug as "debug" mode but as "Release" mode last time.

But even when I debugged as "debug" mode, it did have any value for the cn.

What might be an issue?
I would appreciate for any feedback.

Thanks.

"Justin Doh" wrote:
Quote:

> Actually, I am not sure whether it is still causing an error or not.
>
> This is what is showing after debug.
> At the end, it indicates "..has existed with code 0 (0x0)", but it still
> shows the message "Exception: The ConnectionString property has not been
> initialized" at the command prompt.
> ----------------------------------------------------------------------------------
> 'DefaultDomain': Loaded
> 'c:\winnt\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded.
> 'RootCause2': Loaded 'P:\My Documents\Work-others\Other
> Misc\bin\RootCause2.exe', No symbols loaded.
> 'RootCause2.exe': Loaded
> 'c:\winnt\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50a3a\microsoft.visualbasic.dll', No symbols loaded.
> 'RootCause2.exe': Loaded
> 'c:\winnt\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll', No symbols loaded.
> 'RootCause2.exe': Loaded
> 'c:\winnt\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll', No
> symbols loaded.
> 'RootCause2.exe': Loaded
> 'c:\winnt\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll', No symbols loaded.
> 'RootCause2.exe': Loaded
> 'c:\winnt\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll', No symbols loaded.
> 'RootCause2.exe': Loaded 'p:\my documents\work-others\other
> misc\bin\libdata.dll', No symbols loaded.
> The program '[1356] RootCause2.exe' has exited with code 0 (0x0).
>
> I am not sure what is going on.
> Any feedback is appreciated.
>
> Thanks in advance.
> Justin
>
>
> "Norman Yuan" wrote:
>
Quote:

> > Simply do a debugging to see if the ConnectionString is actually loaded from
> > web.config or not:
> >
> > Public Function getEmailNotify() As DataSet
> >
> > ''Place breakpoint HERE, to see what value "cn" gets, so you know the
> > setting is read in correctly ornot.
> > Dim cn As
> > String=System.Configuration.ConfigurationSettings.AppSettings.Get("Prod")
> >
> > Return obj.GetData("spSendEmailNotification", cn)
> >
> > End Function
> >
> >
> >
> > "Justin Doh" <JustinDoh@xxxxxx> wrote in message
> > news:E0FDFBA3-F3B2-4441-9701-AFDBA8D494AF@xxxxxx
Quote:

> > > Hello.
> > > I had this error for a long time, and I need some help.
> > >
> > > My program is a very simple System.Web.Mail program that calls a stored
> > > procedure “spSendEmailNotification” and get data.
> > > And based on the value that I get from the stored procedure, Web Mail is
> > > sent of not.
> > >
> > > Basically, I get this error when I execute an EXE file using Command
> > > Prompt:
> > > “Exception: The ConnectionString property has not been initialized”
> > >
> > > My first approach was looking at the Web.Config file.
> > >
> > > <?xml version="1.0" encoding="utf-8" ?>
> > > <configuration>
> > > <appSettings>
> > > <add key="Prod" value="server=SQL1;database=Prod;Integrated Security=SSPI"
> > > />
> > >
> > > Or should I use this?? I am not sure what to add for the Password.. I just
> > > guessed.
> > >
> > > <add key="Prod" value="User ID=prod_group;Password=prod^group;data
> > > source=SQL1;persist security info=True;initial catalog=Prod" />
> > >
> > >
> > > After getting the error, I added the following lines inside
> > > <configuration>
> > > at the Web.Config file inside <configuration> hoping that it would resolve
> > > the error.
> > >
> > > <connectionStrings>
> > > <add name="Prod"
> > > connectionString="Data Source=SQL1;Integrated
> > > Security=SSPI;Initial
> > > Catalog=Prod;"
> > > providerName="System.Data.SqlClient" />
> > > </connectionStrings>
> > >
> > >
> > >
> > > This is what is written at the business layer.
> > >
> > > Public Function getEmailNotify() As DataSet
> > > Return obj.GetData("spSendEmailNotification",
> > > System.Configuration.ConfigurationSettings.AppSettings.Get("Prod"))
> > > End Function
> > >
> > >
> > > I would appreciate if anyone gives me some feedback.
> > >
> > > Thanks in advance.
> > >
> > >
> >
> >
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Set Focus To Specific Property In Property Grid .NET General
How can I change a ConnectionString depending on the dev or prod environment ? .NET General
Vista Install Error: Exception Unknown Software Exception Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46