Hi,
I am fairly new to ASP.NET and have been working on a web form that will
allow a user to upload images to a database. I have found a sample web form
that I have been trying to get working, and the web form loads up fine but
upon submitting the image, it comes with the following error:
The ConnectionStrin g property has not been initialized.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.InvalidO perationExcepti on: The ConnectionStrin g
property has not been initialized.
Source Error:
Line 129: Try
Line 130:
Line 131: myConnection.Op en()
Line 132:
Line 133:
myCommand.Execu teNonQuery()
I found this script from the following website http://aspalliance.com/articleViewer.aspx?aId=138&pId=
Can anyone please help I am completely lost as to how to correct this problem.
I am using Visual Studio 2005 beta 1, IIS 6.0, .NET version 2.0.40607 and
SQL Server 2000.
Any help would be greatly appreciated.
Thank,
Devante 4 46704
The exception is very clear. The ConnectionStrin g property has not been set,
when trying to call Open the SqlConnection object.
So obviously, this property is not being set - hence the connection can't do
it's job.
Looking through the code, it looks like the connection string is being
retrieved from Web.config: Dim myConnection As New
SqlConnection(C onfigurationSet tings.AppSettin gs("ConnectionS tring"))
Unless you have a ConnectionStrin g setting in your Web.config with a valid
connection string to your database, this isn't going to work. I am guessing
you never added this setting. Did you think this source code would somehow
know how to connect to your particular sql server? You had to have somehow
specified how to connect.
"Devante" <De*****@discus sions.microsoft .com> wrote in message
news:EC******** *************** ***********@mic rosoft.com... Hi,
I am fairly new to ASP.NET and have been working on a web form that will allow a user to upload images to a database. I have found a sample web
form that I have been trying to get working, and the web form loads up fine but upon submitting the image, it comes with the following error:
The ConnectionStrin g property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidO perationExcepti on: The ConnectionStrin g property has not been initialized.
Source Error:
Line 129: Try Line 130: Line 131:
myConnection.Op en() Line 132: Line 133: myCommand.Execu teNonQuery()
I found this script from the following website http://aspalliance.com/articleViewer.aspx?aId=138&pId=
Can anyone please help I am completely lost as to how to correct this
problem. I am using Visual Studio 2005 beta 1, IIS 6.0, .NET version 2.0.40607 and SQL Server 2000.
Any help would be greatly appreciated.
Thank,
Devante
Sounds like you did not specify a connection string when creating your
SqlConnection object. If you copied the code from the link that you
specified then you have a line of code looking like this:
Dim myConnection As New
SqlConnection(C onfigurationSet tings.AppSettin gs("ConnectionS tring"))
This indicates that whoever wrote the code put the connection string in the
appSettings section of the web.config file. If you did not do this then
ConfigurationSe ttings.AppSetti ngs("Connection String") returns null and the
SqlConnection object does not know which database to connect to. So you have
to specify your own connection string instead.
HTH, Jakob.
"Devante" wrote: Hi,
I am fairly new to ASP.NET and have been working on a web form that will allow a user to upload images to a database. I have found a sample web form that I have been trying to get working, and the web form loads up fine but upon submitting the image, it comes with the following error:
The ConnectionStrin g property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidO perationExcepti on: The ConnectionStrin g property has not been initialized.
Source Error:
Line 129: Try Line 130: Line 131: myConnection.Op en() Line 132: Line 133: myCommand.Execu teNonQuery()
I found this script from the following website http://aspalliance.com/articleViewer.aspx?aId=138&pId=
Can anyone please help I am completely lost as to how to correct this problem. I am using Visual Studio 2005 beta 1, IIS 6.0, .NET version 2.0.40607 and SQL Server 2000.
Any help would be greatly appreciated.
Thank,
Devante
Hi Jakob
I have created a web.config file and it does have the following info in it:
<configuratio n xmlns="http://schemas.microso ft.com/.NetConfigurati on/v2.0">
<appSettings />
<connectionStri ngs>
<add name="AppConnec tionString1"
connectionStrin g="Server=DCKUE PERS-01;Integrated
Security=True;D atabase=WebDev"
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>
But for some reason its still not working what am I doing wrong?
Thank you,
Devante
"Jakob Christensen" wrote: Sounds like you did not specify a connection string when creating your SqlConnection object. If you copied the code from the link that you specified then you have a line of code looking like this:
Dim myConnection As New SqlConnection(C onfigurationSet tings.AppSettin gs("ConnectionS tring"))
This indicates that whoever wrote the code put the connection string in the appSettings section of the web.config file. If you did not do this then ConfigurationSe ttings.AppSetti ngs("Connection String") returns null and the SqlConnection object does not know which database to connect to. So you have to specify your own connection string instead.
HTH, Jakob.
"Devante" wrote:
Hi,
I am fairly new to ASP.NET and have been working on a web form that will allow a user to upload images to a database. I have found a sample web form that I have been trying to get working, and the web form loads up fine but upon submitting the image, it comes with the following error:
The ConnectionStrin g property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidO perationExcepti on: The ConnectionStrin g property has not been initialized.
Source Error:
Line 129: Try Line 130: Line 131: myConnection.Op en() Line 132: Line 133: myCommand.Execu teNonQuery()
I found this script from the following website http://aspalliance.com/articleViewer.aspx?aId=138&pId=
Can anyone please help I am completely lost as to how to correct this problem. I am using Visual Studio 2005 beta 1, IIS 6.0, .NET version 2.0.40607 and SQL Server 2000.
Any help would be greatly appreciated.
Thank,
Devante
The line ConfigurationSe ttings.AppSetti ngs("Connection String") will not work
with the config file you posted. Are you using this line of code? If yes,
then your config file should look like this:
<appSettings>
<add key="Connection String" value="..." />
</appSetting>
Or have you defined a configSection for reading the connection string? In
any case, I don't think you are reading the connection string correctly from
the config file, so you should do some debugging trying to find out what the
problem is.
Regards, Jakob.
"Devante" wrote: Hi Jakob
I have created a web.config file and it does have the following info in it:
<configuratio n xmlns="http://schemas.microso ft.com/.NetConfigurati on/v2.0">
<appSettings /> <connectionStri ngs> <add name="AppConnec tionString1" connectionStrin g="Server=DCKUE PERS-01;Integrated Security=True;D atabase=WebDev" providerName="S ystem.Data.SqlC lient" /> </connectionStrin gs> But for some reason its still not working what am I doing wrong? Thank you,
Devante
"Jakob Christensen" wrote:
Sounds like you did not specify a connection string when creating your SqlConnection object. If you copied the code from the link that you specified then you have a line of code looking like this:
Dim myConnection As New SqlConnection(C onfigurationSet tings.AppSettin gs("ConnectionS tring"))
This indicates that whoever wrote the code put the connection string in the appSettings section of the web.config file. If you did not do this then ConfigurationSe ttings.AppSetti ngs("Connection String") returns null and the SqlConnection object does not know which database to connect to. So you have to specify your own connection string instead.
HTH, Jakob.
"Devante" wrote:
Hi,
I am fairly new to ASP.NET and have been working on a web form that will allow a user to upload images to a database. I have found a sample web form that I have been trying to get working, and the web form loads up fine but upon submitting the image, it comes with the following error:
The ConnectionStrin g property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidO perationExcepti on: The ConnectionStrin g property has not been initialized.
Source Error:
Line 129: Try Line 130: Line 131: myConnection.Op en() Line 132: Line 133: myCommand.Execu teNonQuery()
I found this script from the following website http://aspalliance.com/articleViewer.aspx?aId=138&pId=
Can anyone please help I am completely lost as to how to correct this problem. I am using Visual Studio 2005 beta 1, IIS 6.0, .NET version 2.0.40607 and SQL Server 2000.
Any help would be greatly appreciated.
Thank,
Devante This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TPSreport |
last post by:
I log on to the cookieless application, work within it
for awhile, jump to a URL outside the application, then
return to the application. As soon as a db call is
required, I get the error below. web.config also below.
Thanks in advance for your ideas!
TPS
error message:
The ConnectionString property has not been initialized.
Description: An unhandled exception occurred during the
|
by: Kamal |
last post by:
Hi everyone,
I've created a user control that calls some method from a class that set the
connection string, the connection string is stored in the App.Config file.
When i try to add that control into a form, the following message Appears:
"The ConnectionString property has not been initialized"
and i won't allow me to add it and if i add my control in code, the
designer won't work and would display only the above message?!
|
by: josephrthomas |
last post by:
hi...i am getting a error here...saying :
**quote**
The ConnectionString property has not been initialized.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.
Exception Details: System.InvalidOperationException: The
ConnectionString property has not been initialized.
|
by: Tony |
last post by:
Dear All,
When I run an example program on the
http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3
I received an error message:
"The ConnectionString property has not been initialized.
|
by: Laura K |
last post by:
Tried all kinds of things. I get the error.
The ConnectionString property has not been initialized.
Any help appreciated.
-----------------------------------------------------------------------------------------------------
This is the web.config info
| |
by: Kent Johnson |
last post by:
Hi all,
I have accidentally deleted my web.config file so I'll have to recreate it.
I have tried this in my Web.config file:
<configuration>
<appSettings>
<add key="ConnectionString"
value="server=localhost;uid=sa;password=MyPwd;database=MyDB"/>
</appSettings>
|
by: tshad |
last post by:
I am trying to create an application in my VS 2002 application. I took some
of the code from my web page where it works fine.
I can connect fine from my Sql Query Analyser to both my local Sql Server
and off Sql Server machines.
But I am getting the following error from my "objConn.Open()".
Is this a problem from going from my web to a normal application?
|
by: QC |
last post by:
Hi,
this morning found that my Service had crashed, and the error was
"Exception Details: System.InvalidOperationException: The
ConnectionString property has not been initialized". I have no clue
WHY the ConnectionString wouldn't be initialized as I do not play with
anything near it in my code. my service is running perfectly from last
few years, and the same code executed millions of time. I am using VS
2003, .net 1.1.
Do you have any...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |