我可以将 osql 与 Sql server Compact Edition 一起使用吗

编程入门 行业动态 更新时间:2024-10-27 06:27:05
本文介绍了我可以将 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 吗?如何指定数据库/文件路径?或者我可以通过其他方式连接吗?

解决方案

查看 social.msdn.microsoft/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 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?

解决方案

Check out social.msdn.microsoft/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 一起使用吗

本文发布于:2023-10-16 11:37:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497447.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Sql   osql   server   Edition   Compact

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!