Deploy Connect String Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is for a Win form.

I created a "Setup and Deployment Project", added my exe and app.config file
to the "Application Folder". I then built the solution.

I ran the setup file on my computer with no errors. When I try to run the
exe that the setup program created I get an error, "The ConnectionString
property has not been initialized."
 
Hi Cadel,

From the error message, this is not an installation issue. It seems that a
connection's ConnectionString property was not set properly. When the
connection string is empty, this error was generated. Please check your
code to see if any ConnectionString property was not set.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
The application works in design time, and I can run the exe in the bin folder.
C:\Documents and Settings\mikel.ODWC\My Documents\Visual Studio
Projects\LicenseDealerSales\bin\Debug\LicenseDealerSales.exe

But I can't run the exe in the folder the setup creates.
C:\Program Files\Default Company Name\LicenseDealerSales
Setup\LicenseDealerSales.exe

I get "The ConnectionString property has not been initialized." error message.
 
Hi Cadel,

Please check in your app that where does the ConnectionString come from? Is
it hard coded in the app or loaded from a .config file?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
I have the connection string in App.config.

Here is the code, I removed the password for security.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<appSettings>

<add key="dsn" value="Data Source=db;Database=License;Integrated
Security=False;User ID=de;password=REMOVED" />


</appSettings>

</configuration>
 
Hi Cadel,

From the error mesage, there must be a connection whose connection string
was not set. When opening, the exception is throw. In this case I suggest
you write some code to print out all the connection strings before opening
a connection. This may help you to find which connection string was not
initialized. When you see an empty connection string, it is the problem.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Much easier to use MessageBox.Show then to print connection string.

I figured it out, it was a security issue with .net. I ran caspol.exe and
it fixed it.
 
Nice to hear that you have had the problem resolved.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top