如何填充 SQL Server Compact 数据库? [英] How do I populate a SQL Server Compact database?

查看:54
本文介绍了如何填充 SQL Server Compact 数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在构建一个 Windows 应用程序,因此,我将使用 SQL Server Compact 而不是普通的 SQL Server,因为我认为它可以在任何计算机上运行,​​而不仅仅是使用 SQL Server 的计算机已安装.

So I'm building a windows app, and as a result, I'm going to use SQL Server Compact instead of the normal SQL Server as I figure it can then be run on any computer, not just one with SQL Server installed.

问题是我所看到的,你似乎不能在 SQL Compact 中做任何脚本,你不能声明变量,你一次只能做一个语句.

The problem is from what I've seen, you can't seem to do any scripting in SQL Compact, you can't declare variables, you can only do one statement at one time.

我通常会存储一个参考数据脚本,每次重建数据库时都会运行该脚本.这在 Compact 中可行吗?

I generally have like a reference data script stored that I run everytime I rebuild the database. Is this possible in Compact?

我唯一能想到的就是构建一个单独的应用程序来读取脚本并手动运行每个单独的查询,但这似乎很麻烦.然而,这是唯一的方法吗?

The only thing I can think of is to build a seperate application that reads the script and manually runs each individual query, but that just seems cumbersome. However, is that the only way?

推荐答案

您可以使用我的 SQL Server Compact 脚本工具:http://sqlcetoolbox.codeplex.com(VS 插件)和 http://exportsqlce.codeplex.com(命令行)

You can use my SQL Server Compact scripting Tools for this: http://sqlcetoolbox.codeplex.com (VS add-in) and http://exportsqlce.codeplex.com (command line)

这篇关于如何填充 SQL Server Compact 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆