Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > SQLExpress best practices for deployment
 

SQLExpress best practices for deployment

I am deploying a c# windows App built with VS2008. THe initial deployment via clickonce works great. My question is how am I supposed to handle user who have installed the application locally.

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?


Thanks for any explenation.

Santiago Perez
SantiagoPerez  Wednesday, September 23, 2009 6:20 PM
Yes, it will replace your database. You have to handle it. Check out this thread, which has a post from me with two other threads in it that discuss how to handle this.

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/c8c55be6-be34-47cf-93fc-6cc0bf97f2cf

I'm going to be messing around with this in the next few days because I'm talking about this at the Silicon Valley Code Camp on October 2. Using SQLCE is easy, but you can't just move a SQLExpress db like you would a SQLCE one. What I'm wondering if is I can detach and re-attach a SQLExpress database programmatically. If so, I would copy the database to a different folder, and when there's an update, write some code to specifically handle it.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Friday, September 25, 2009 2:49 AM
Yes, it will replace your database. You have to handle it. Check out this thread, which has a post from me with two other threads in it that discuss how to handle this.

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/c8c55be6-be34-47cf-93fc-6cc0bf97f2cf

I'm going to be messing around with this in the next few days because I'm talking about this at the Silicon Valley Code Camp on October 2. Using SQLCE is easy, but you can't just move a SQLExpress db like you would a SQLCE one. What I'm wondering if is I can detach and re-attach a SQLExpress database programmatically. If so, I would copy the database to a different folder, and when there's an update, write some code to specifically handle it.

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Friday, September 25, 2009 2:49 AM
I just came across this article that I'm sure you've seen by now. http://msdn.microsoft.com/en-us/library/bb264562(SQL.90).aspxTHis is probably the best approach. I am curious though, how would you handle the same scenario using SQLCE?
Santiago Perez
SantiagoPerez  Monday, September 28, 2009 2:30 PM
The difference between SQLExpress and SQLCE is that SQLCE is just a file, and SQLExpress is actually SQLServer "lite". By this, I mean that you can move around the SQLCE database and put it wherever you want and just set the connection string appropriately. As I understand it, with SQLExpress, it is attached to a running service on the machine, so you can't move it. (I'm trying to figure out if I can detach it and reattach it, but I'm fairly certain a ClickOnce app won't have the privs to do this).

You can deploy SQLCE by just including the DLL's, you don't have to install it as a prerequisite, which makes deployment about a hundred times easier. This also gives you complete control over the dll's and what version you are using, rather than being at the whim of whoever has the computer. And as noted above, you can move the file around. Backups? Pfui! Just copy the dang file.

SQLExpress has more features. So if you need those features, then that's the way to go. If I could get away with SQLCE, that's what I personally would use.

The only downside to scripting your database is if you want to deploy a new one, you have to write all of the changes in script and have the application apply them. In most cases, I'd think that was okay. But if you added a bunch of tables, it might be a pain.

I think you can create a SQLCE database on the fly using a script, but I can't swear to that. You'd have to try it. On the bright side, it wouldn't require any elevated permissions because you don't have to attach it to a running SQLServer, which seems like it would be the case with SQLExpress.

That's my two cents'.

RobinDotNet


Click here to visit my ClickOnce blog!
RobinDotNet  Tuesday, September 29, 2009 3:43 AM

You can use google to search for other answers

Custom Search

More Threads

• This advertised application will not be installed because it might be unsafe. Contact your administrator to change the installation user interface option of the package to basic.
• ClickOnce update runs old version
• Permission Issue With Smart Client
• Deployement of a C++ Application Problem
• Install Errors with .net 3.5 sp1
• SignTool: Hangs and fails
• Is there a way to add setup code to clickonce?
• Is it Okay to have a Publish Status of Include for Referenced Components as far as Possible
• Click Once Deployment for PDA
• ClickOnce: Problem creating my own manifest files (.NET 2.0)