我可以将 osql 与 Sql server Compact Edition 一起使用吗
我有一个包含大量插入语句的文件,用于用测试数据填充我的紧凑版数据库。每次运行单元测试(我使用的是 NUnit)时,我都从 Sql Server Management Studio 运行该文件。 现在我想自动运行每个测试的数据库脚本。我正在尝试按照本文所述使用 osql: 对数据层进行单元测试 问题是我不知道如何使用 osql 连接到 sdf 文件。 我有两个问题,首先我没有数据库的用户 ID,只有密码。我已经在命令行提示符下尝试过:
osql -P manager -S 192.168.1.117 -i "C:\...\InsertTestData.sqlce" -D "C:\...\Test.sdf"
Error: No user selected. Try with -U or -E switches
其次,我不知道如何指定数据库。我已经尝试过:
osql -P manager -S 192.168.1.117 -i "C:\...\InsertTestData.sqlce" -D "C:\...\Test.sdf" -U sa
[ODBC Driver Manager] Data source name not found and no default driver
specified
那么我可以将用户 ID 添加到 Sql CE Server 吗? 如何指定数据库/文件路径? 或者还有其他方式可以连接吗?
I have a file that contains lots of insert statements to populate my compact edition database with test data. I have been running the file from Sql Server Management Studio each time I run a unit test (I'm using NUnit).
Now I want to automate the running of database scripts for each test. I'm trying to use osql as described in this article: Unit testing the data layer
The problem is that I don't know how to connect to an sdf file using osql.
I have 2 problems, First I don't have a User Id for the database, only a password. I've tried this at a command line prompt:
osql -P manager -S 192.168.1.117 -i "C:\...\InsertTestData.sqlce" -D "C:\...\Test.sdf"
Error: No user selected. Try with -U or -E switches
Second, I don't know how to specify the database. I've tried this:
osql -P manager -S 192.168.1.117 -i "C:\...\InsertTestData.sqlce" -D "C:\...\Test.sdf" -U sa
[ODBC Driver Manager] Data source name not found and no default driver
specified
So can I add a user id to Sql CE Server?
How do I specify the database/filepath?
Or is there another way I can connect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 http:// Social.msdn.microsoft.com/Forums/en-CA/sqlce/thread/9540dbe4-e0d9-4381-a475-42691d641570
看来 osql 和 sqlcmd 不适用于紧凑版本。
Check out http://social.msdn.microsoft.com/Forums/en-CA/sqlce/thread/9540dbe4-e0d9-4381-a475-42691d641570
It would seem that osql and sqlcmd do not work for compact editions.
您可以使用 sqlcecmd: http://sqlcecmd.codeplex.com
You can use sqlcecmd: http://sqlcecmd.codeplex.com