Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Deployment and SQLExpress?
 

Deployment and SQLExpress?

I'm just finishing up a deployment project that does a setup with Windows installer where a requisite is SQLExpress.

It all works well and then I tried installing it on a clean system and it failed.

How does one attach a database in a installation?

How does one create a user instance?

The requirements are pretty simple and this is not an ultra-high security project.

Last nighteven on aclean system, I was unable to get the application to work with a newly installed SQLExpress even with the SQL Management CTP.

I'm hoping there is some simple way to do this.

Renee

ReneeC  Friday, January 27, 2006 3:10 PM

All the answers on this great article:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/EmSQLExCustApp.asp

User instances:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sqlexpuserinst.asp

If you have any other questions post here and i will try to answer

Itzik Katzav

Itzik Katzav  Friday, January 27, 2006 6:37 PM

All the answers on this great article:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/EmSQLExCustApp.asp

User instances:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sqlexpuserinst.asp

If you have any other questions post here and i will try to answer

Itzik Katzav

Itzik Katzav  Friday, January 27, 2006 6:37 PM

I have a similar issue but I'm using CLickOnce. At first I had User Instance = True with initial deployment. THen I realized what User Instance once and decided I didn't need it since it was going on a single user's assigned laptop.

THis is my app.config:

<

add name="connstring" connectionString="Data Source=(local)\SQLExpress;AttachDbFilename=|DataDirectory|\FDOT_TAT_C.mdf;Integrated Security=True;User Instance=False;" providerName="System.Data.SqlClient" />



This is a standard C# Windows Forms application. THe problem that I'm getting now is that I'm getting the following error message:

AN Attempt to attach to an auto-named database for file C:|Documents and Settings\kn854se\Local Settings\Apps\2.0\Data\E4MQOGJJ.5KT\.....\Data\FDOT_TAT_C.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

THe path is referenced in the error message is not the path of the .exe. From what I read about using the |DataDirectory| is that it looks in the same folder as where the.exe is running. If this is the case how do I tell CLickOnce to put the database in the same folder as the .exe?

Can someone please shed some light on this as I'm sure I'm not the only one that has gone through this.


THanks in advance for your time.


Santiago Perez
SantiagoPerez  Tuesday, September 22, 2009 2:55 PM
Just an aupdate I have downloaded and run the SSEUtil tool and noticed I had a database with the same name attached to my user instance but as I said in my previous post, I don't want that so I went ahead detached the database and confirmed the only user instance of SQLExpress on this machine does not have any custom databases attached as well as the main .\SQLExpress instance leading me to believe it's an access issue to the database which was my concern in the previous post.

ANy ideas?

Santiago Perez
SantiagoPerez  Tuesday, September 22, 2009 3:11 PM
Another update, changed my app.config to read as follows, taking out the DataDirectory portion of the connection string:

<

add name="connstring" connectionString="Data Source=(local)\SQLExpress;AttachDbFilename=FDOT_TAT_C.mdf;Integrated Security=True;User Instance=False;"

providerName="System.Data.SqlClient" />

Same result. !


Santiago Perez
SantiagoPerez  Tuesday, September 22, 2009 3:39 PM
I'm assuming the user who is trying to install and run the application has SQLServer Express installed? You've specified it as a prerequisite, or already installed it?

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Wednesday, September 23, 2009 1:06 AM
Presumably you are deploying the database with your ClickOnce application? If it's deployed as a data file (look in Application Files, is it "Include(Data)"?). If you are deploying it asa datafile, it will be placed in the DataDirectory, so you need that part of the connection string.

Does the database have the user's credentials in it? You are using integrated security, which means it uses his windows credentials to access the database.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Wednesday, September 23, 2009 1:08 AM
I got it to work using the SSEUtil tool. I also uninstalled all previous versions and removed the the subfolders under Apps/2.0. Now I need some further clarification on the Publish Status settings. You ask if it's (Data). Can you explain the difference? I am concerned that once the user has installed this app and has entered some data, when I push my update for the application along with the database for existing users as well as new users will the existing users loose their data? How does that work?

Santiago Perez
SantiagoPerez  Wednesday, September 23, 2009 6:20 PM
Hi, you posted this as a separate question/thread, so I've answered it there. Let's move the conversation over there...

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Friday, September 25, 2009 2:59 AM

You can use google to search for other answers

Custom Search

More Threads

• Only install file if it does not exist on target machine
• Updating data files
• Deployment problem (after like 70 deployments)
• How Do I Publish a Project in a Team Build Environment?
• Setup and app.config : how to not overwrite existing config while installing a newer version ?
• How to Place a document in client machine during installation?
• Do web references need to be deployed?
• optionally install MSM modules
• Manifest files deleted and nothing works! Help!!
• Nlog & ClickOnce