Deploy SQL Server App to SQL Server Express?
I have a winforms app developed using VB .Net 2008 and a SQL Server 2005 database. I want to deploy the app as a stand-alone using an included SQL Server Express DB. However, I have never done this before and would like some help in configuring and publishing the app.
Any help would be most appreciated.
Thanks in advance
Will
Re: Deploy SQL Server App to SQL Server Express?
Not very clear on what you want to do. Is your database going to be on the same machine as the application? In that case all you'll need to do is the connection string setting to point to the local machine instance.
Re: Deploy SQL Server App to SQL Server Express?
I have built the application using a SQL Server database, but I now want to publish it with an embedded SQL Server Espress database so it will run on a client machine.
In the App Properties/Prerequisits, I have set the checkbox to SQL Server Express. When I run the application from another machine, it gives me an error that the database is not found. So I guess you are right about the connection string. Could you tell me the proper form to use in the string to make it access the SSE database?
I have tried these two, but no result:
<add name="StudentMedi_CalBillingMain.My.MySettings.IleanConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDBFilename=Ilean.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="StudentMedi_CalBillingMain.My.MySettings.IleanConnectionString"
connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=Ilean;Integrated Security=True"
providerName="System.Data.SqlClient" />
Thanks for the help.
Will
Re: Deploy SQL Server App to SQL Server Express?
For any type of connection string, the site to look to is: http://www.connectionstrings.com/sql-server-2005 (scroll down a bit to see the strings for SSE)
Your first connection string looks good to me, except that the path of Ilean.mdf is not specified.
Also, will all the users have instance of SSE pre-installed on their machines or will you be installing them? I am not sure on this one but maybe then you need to set it up to accept windows authentication for login.
Re: Deploy SQL Server App to SQL Server Express?
By the path not being specified, I take it you mean that it should be ...AttachDBFilename=Path\Ilean.mdf... ?
I guess that is my problem. I don't know what the path to the database is if it is embedded in the application. Is the path the same as the installed directory? Or is there a new database set up separately? How do I determine what the path should be?
It is my understanding that if SSE does not exist on the target machine, it will be downloaded by the setup.exe for the application. But I am not sure of that. If it is the case, where does it get installed? Is there a default directory/path?
Thanks again. We seem to be getting someplace, I am just not too sure where! :D
Re: Deploy SQL Server App to SQL Server Express?
I'm not sure I understand what you mean by "embedded database" but assume that you are placing it in the Data folder of the solution. In that case the path should be like
Code:
AttachDbFilename=|DataDirectory|\Ilean.mdf
This path has got nothing to do with the SSE install directory. All .Net does is use the mdf file to attach to the SSE.
Installing the SSE should be with setup.exe and if you are the author of setup you should make sure it is installed on user machine while installing the app. You can actually bundle the SSE installer with your setup program and then install or skip based on what user has on their system.
Re: Deploy SQL Server App to SQL Server Express?
That is about the clearest explanation I have seen yet. So how do I buncle the SSE installer with the app?
Sorry for all the questions, but I really have not done this before. Thanks again.
Will
Re: Deploy SQL Server App to SQL Server Express?
You can use the .Net Setup & Deployment project (available in Other Project Types) to create an installer for your application. When you right click on the project and open the property pages, you will see a Prerequisites button. Click on that and you'll find the .Net version is auto selected and towards the end you will find the SQL Server Express. Select that and you should be fine. Just to let you know, I have never created a setup with SSE as prerequisite, so you'll have to try and see if this works.
eDIT: Got an MSDN link on Setup & Deployment ( http://msdn.microsoft.com/en-us/libr...17(VS.80).aspx)