Click-once SQL Server Express deployment - vb.net

We are developing a small application that needs to have a local database installed on each users computer that will then sync up to the main database, via web services etc...
Anyways when we deploy the application on the users computer we want to use clickonce deployment. Now I have used this before but not attaching a SQL Server database. I know you can go to prerequisites in clickonce properties and click SQL Server Express.
Now the question is, when you have created your .mdf database file including stored procedures and all - how do you get this attached and setup automatically in the local database that is just installed through clickonce?
Also once this is finished in the future we may want to run updates to the database on the clients machines. We would like to use clickonce for this to publish database updates. Obviously we don't want to overwrite the database and just publish the latest updates based on if they already have the database or not and what version they have.
How could this be achieved using clickonce? Thanks

Related

Building a Visual studio project with access database

Need some advice on the best way to go about this. I've finished my project and need to submit it for grading. This means it will need to be installed on the graders machine and will need to include the Access database that it's linked to.
What's the best way to do this?
You can deploy an MS Access database with ClickOnce.
MSDN Accessing Local and Remote Data in ClickOnce Applications
ClickOnce deployment of Access database
Can i use clickOnce to deploy MS Access database?

VB.NET Creating a local database in VS2013 or in SQL Server Management Studio

I am about to begin a personal project to build my skills in the .net environment. I am familiar with SQL Server Management Studio and how to create a database in it but I discovered how to make a local database in Visual Studio as well. My program is only going to require local database access as it will be used for individual inventory systems rather than connected ones. Am I ok to use the onboard tools in visual studio and create a local databasse or should I be using the SQL Server Management Studio?
When you use the Local Database item template in VS, it creates a SQL Server CE data file (SDF) and adds it to your project. When you use the Service-based Database item templete, it creates a SQL Server (Express) data file (MDF) and adds it to your project.
The advantage of using the VS tools is that the data file becomes part of your project and can therefore be easily deployed with the compiled application. As such, the database is basically part of the application.
If you choose SQL Server CE then you don't need a server installed on the user's local machine. They can install SQL Server CE or you can install it with your app if you want, but you also have the option of simply deploying a DLL with your app and it will work.
If you choose SQL Server Express then the user actually needs a SQL Server instance installed on their machine. To be honest, I'm not 100% sure whether that instance must be SQL Server Express or it can be a full SQL Server instance too. It would usually be SQL Server Express though, which you can install and even download automatically when you install your app, depending on the deployment method you choose.
If you use the VS tools to create an MDF data file then your connection string will contain the Data Source and AttachDbFilename attributes. The Data Source will generally be ".\SQLExpress", i.e. an instance named "SQLExpress" on the local machine. That instance name is not required, although it is the default for SQL Server Express, but it must be on the local machine. The MDF file gets attached at run time and detached again when you're app is done with it. It will also usually be attached to a user instance, which means that other users can't see it, even when it's attached. Note that, in later versions, the LocalDB feature of SQL Server may also be utilised.
If you create your database in Management Studio then it's not actually part of your app. It will be permanently attached to the SQL Server instance so, everyone will be able to see it and open it, assuming permissions allow. Creating the database during deployment will be an extra step in that case. You might create a backup and restore that during deployment or generate SQL scripts that get run. In this case, your connection string will contain the Initial Catalog attribute to specify the name of database to connect to, as well as the Data Source attribute. This option is required if you want multiple clients to be able to connect to the database.
In short, if you are only going to be accessing a database from the local instance of the one application then creating a database in VS is OK and probably a good idea. Whether you choose SQL Server CE or SQL Server Express may well depend on what level of functionality you need.

Web Deploy does not update SQL database schema changes

I am newer to Visual Studio 2012 and MVC4, and have a development project of a website using C# and MVC4 and SQL server 2012.
The Publish using web deploy works for the website portion of the project, but it does not automatically update the database portion (schema). If I right click the database portion of the project in VS2012 and click Publish, then the database schema is updated properly. I am only interested in schema updates. What could be wrong?
I programmed my development system to use Web Deploy 3.0. Here is a summary of my configuration:
Computer running win8 x64
SQL Express 2012 as my database server, running as the default instance (i.e. at localhost, NOT as .\SQLEXPRESS)
IIS Express 8 as my webserver, using the "Default Web Site" site (localhost)
Visual Studio 2012 Pro using MVC4 and C#
Web Deploy 3.0
The latest dates are all applied to the software
I programmed an SQL server user WDeployAdmin for managing the database updates and gave it full permissions over the database being used for the website. I also tried using Integrated Security (my administrator login) but that does not help.
I can correctly update the Default Web Site (views and controllers etc) using the Publish feature in VS2012 which uses Web Deploy 3.0.
When I use the Test Connection feature of the publishing setup options, it correctly connects to the database, and that certainly works fine when I do a separate Publish DB operation (right-click DB project, click Publish, and then pick my profile) for that part of my project.
So why doesn't the standard website Publish feature include the database schema updates? The standard website Publish always shows an empty change to database when the schema changes (e.g. a table or a stored procedure).
I have read through much MS docs but nothing is apparent to me.
Any help is appreciated,
Bruce

Migrating SharePoint from one machine to another machine

I had a SharePoint server, now i want to move this from one machine to another machine.
This is what i did for the migration.
I have just installed sharepoint server in my new machine and i have removed the Sharepoint_config and wss_content databased from the new server. and i have restored both the databases from the old server. Then i tried to run the Central Admin and i got Unable to connect to content database error.
Is replacing the DB is wrong. is there any other way to migrate SP server from one machine to another. I have tried my taking Farm backup and restore i had many problem with that. so i feel replacing DB would be better for me. any suggestions please?
Move SharePoint between servers is a huge effort.
Data in databases are very depends on the SharePoint install and its environments. So, I suggest just re-install the SharePoint on the new server, and then restore site collection backups to the new install.
Install SharePoint Server on the new server machine
Backup site collections from the old server, follow this guide: http://technet.microsoft.com/en-us/library/cc263441(v=office.12).aspx
Create Web Applications on the new server
Restore site collections from the prev. backups, follow this guide: http://technet.microsoft.com/en-us/library/cc262087(v=office.12).aspx
Be aware, if you have farm level customize solutions (developed by Visual Studio) or css files deployed in the LAYOUT folder, don't forget to re-deploy them on the new server.
I guess this question is too old and my answer will not help topicstarter... However, I was looking to refresh my own knowledge on this topic and I feel it will be useful to share it here.
This solution is not good for every SharePoint deployments, of course, it's just a general idea.
And I don't think it suits production environments well... but if you are brave and foolish as myself, you can do it there as well, with some additional precautions like backups and so on.
Here are prerequisites:
SharePoint was initially installed in Farm mode (not in Single Server mode)
Both old and new servers are in the same domain
You know Farm Passphrase used for initial installation
Old server is still intact and accessible from the new server
Steps to do
Skip steps 2-6 if you don't want to move databases to new location
Install SharePoint on the new server and join to existing farm. See
https://technet.microsoft.com/en-us/library/cc261752.aspx for details on joining procedure.
Ensure that the SharePoint is read-only. You can just shut down MS SQL DBEngine service if it's ok for your users.
Install MSSQL Server on the new server or other location you want. Remember, that it's not a good idea to keep SharePoint and MSSQL on the same server if it's not a demo/dev environment
Move all SharePoint databases to the new MSSQL Server. You can simply copy all DB files and attach it to the new SQL, or go full backup and restore way.
Important: Create an SQL client alias on the new server with cliconfg tool. See blogs.msdn.com/b/priyo/archive/2013/09/13/sql-alias-for-sharepoint.aspx for details.
Use your old SQL instance name as alias name. E.g. if your old server had SQL installed alongside with SharePoint on SharePoint.mydomain.com, alias name should be "SharePoint.mydomain.com"
Set Server name for alias to the new SQL location. Something like "NewServer.mydomain.com"
Ensure that you specify correct port number for SQL connection or configure network for default dynamic port. It is not necessary only if you have local SQL server on the same machine.
Create identical SQL client alias on the old server (this is needed to correctly remove old server from farm)
Remove old server from the farm. See this technet article for details
Update DNS settings or whatever you use to point users to the new server.
That's it. Hope it will help someone

How to distribute SQL Server Database to clients

I have a WPF application that I want to deploy to client PCs via a Setup. My setup application will contain the .Net framework and SQL Server Express 2008 edition and will install these on the client if needed and without user interaction.
Now I need a way to create the database and tables, etc... on the client without any user interaction.
Should I deploy the .MDF .LDF to the client PCs and attach the database to SQL Server Express?
Or should I create a script and run the script on the client to create the database and tables?
Plus, I need to ensure that the app.config settings are correct.
What is the best way to handle distributing a database to the client during a Setup.exe with user interaction?
If you're deploying a stand-alone application to desktop clients, forcing them to install SQL Server Express is the wrong choice. You're going to run into issues if SQL Server stops working on the client's PC.
You should instead use SQL Server Compact Edition (which doesn't require a server to be installed on the client's PC). You can include the database file as part of the installation process with all of the blank tables and everything already created.