本文介绍了我可以将 osql 与 Sql server Compact Edition 一起使用吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个包含大量插入语句的文件,用于用测试数据填充我的精简版数据库.每次运行单元测试时,我都从 Sql Server Management Studio 运行该文件(我使用的是 NUnit).现在我想为每个测试自动运行数据库脚本.我正在尝试按照本文所述使用 osql:单元测试数据层问题是我不知道如何使用 osql 连接到 sdf 文件.我有两个问题,首先我没有数据库的用户 ID,只有密码.我在命令行提示符下试过这个:

osql -P manager -S 192.168.1.117 -i "C:\...\InsertTestData.sqlce" -D "C:\...\Test.sdf"错误:未选择用户.尝试使用 -U 或 -E 开关

其次,我不知道如何指定数据库.我试过这个:

osql -P manager -S 192.168.1.117 -i "C:\...\InsertTestData.sqlce" -D "C:\...\Test.sdf" -U sa[ODBC 驱动程序管理器] 未找到数据源名称且无默认驱动程序指定的

那么我可以向 Sql CE Server 添加用户 ID 吗?如何指定数据库/文件路径?或者我可以通过其他方式连接吗?

查看 http://social.msdn.microsoft.com/Forums/en-CA/sqlce/thread/9540dbe4-e0d9-4381-a475-42691d641570>

osql 和 sqlcmd 似乎不适用于精简版.

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 layerThe 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?

解决方案

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.

这篇关于我可以将 osql 与 Sql server Compact Edition 一起使用吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 17:20