开发者

Can I use osql with Sql server Compact Edition

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 co开发者_开发百科nnect?


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.


You can use sqlcecmd: http://sqlcecmd.codeplex.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜