简体   繁体   English

部署后更新

[英]Updating once deployed

I have searched everywhere, however have not found a straightforward answer. 我到处搜索,但是没有找到简单的答案。

I have deployed a WinForms C# .NET application, which uses a LocalDb SQL Server 2012 Express database. 我已经部署了WinForms C#.NET应用程序,该应用程序使用LocalDb SQL Server 2012 Express数据库。 The database is thus a data file contained in the project. 因此,数据库是项目中包含的数据文件。 I would like to add some columns to a number of tables, and since the project is deployed at a lot of clients, I would like to send them a script, or a file of some sort, and once they run it, their database would have these changes. 我想在许多表中添加一些列,并且由于该项目是在许多客户端上部署的,所以我想向他们发送脚本或某种文件,一旦他们运行它,他们的数据库就会有这些变化。

How can this be done? 如何才能做到这一点? There is no SQL Management Studio, so the users cannot login and run a script in there. 没有SQL Management Studio,因此用户无法在其中登录和运行脚本。 I need it to be run based on the LocalDb, and cannot find any solutions online 我需要基于LocalDb运行它,并且无法在线找到任何解决方案

I would consider a batch file that executes sql scripts, like so: 我将考虑执行sql脚本的批处理文件,如下所示:

sqlcmd -S <ComputerName>\<InstanceName> -i C:\Temp\ClearTables.sql

This article provides a fairly good answer. 文章提供了一个相当不错的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM