使用sql数据库创建安装应用程序c#? [英] create setup application c# with sql database ?
问题描述
hi
i使用c#代码创建windows应用程序,连接到sql server数据库,
如何创建安装文件包括我的windows应用程序和数据库里面它?
请帮帮我,,,,,
i需要简单的方法来做我的包裹:))
< blockquote>在大多数安装程序中,例如 instalshield ,您可以在完成安装过程后运行批处理文件。我建议你创建一个默认数据库备份文件并通过该批处理文件恢复它。
默认数据库备份:
当您的表为空或具有硬编码或默认数据时,您从数据库中创建的备份文件。
制作恢复批处理文件:
创建一个新的文本文件并将其扩展名更改为`bat`然后使用`sqlcmd`命令恢复数据库,如下所示:
sqlcmd -S%DB_HOST%-Q< your restore =query =>< / your>
和这样的恢复查询:
RESTORE 数据库%DB_NAME% FROM DISK = ' %BACKUP_FILE%' WITH REPLACE;
或更好的查询请关注此问题
将备份文件和批处理文件添加到您的设置中 :
在进行设置时,添加备份文件和批处理文件,将其添加到目标路径中。
更改设置设置以在设置结束时运行批处理文件>
尝试这些链接 -
使用安装程序类轻松部署SQL Server数据库 [ ^ ]
自动安装SQL 2005 Express的.NET安装程序 [ ^ ]
部署应用程序和数据库 [ ^ ]
hi
i create windows application using c# code , connected to sql server database ,
how can i create setup file included my windows application and database inside it ?
please help me ,,,,,
i need easy way to do my package :)
In most Installers like instalshield you can run a batch file after finishing install process. I suggest you to create a Default Database Backup file and restore it by that batch file.
Default Database Backup:
Is a backup file that you make from your Database when your tables are empty or have hard-coded or default data.
Make a Restore Batch-File:
Make a new Text-file and change its extension to `bat` then use `sqlcmd` command to restore your Database like this:
sqlcmd -S %DB_HOST% -Q "<your restore="" query="">"</your>
And a restore query like this:
RESTORE DATABASE %DB_NAME% FROM DISK = '%BACKUP_FILE%' WITH REPLACE;
Or for a better query follow this question
Add your Backup file and Batch-file to your setup:
When you are making your setup, add the Backup file and Batch-file in it that those will add in the destination path.
Change your setup settings to run Batch-file at the end of setup>
Try these links -
Deploy SQL Server databases easily with an Installer class[^]
.NET Installer that Automatically Installs SQL 2005 Express[^]
Deploy your Application and Database[^]
这篇关于使用sql数据库创建安装应用程序c#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!