wince5.0上SQLCE数据库问题

哈哈潜伏哥 2008-07-20 02:27:50
前辈你好,我现在刚刚接触WINCE编程,被一个问题搞的焦头烂额的,没有办法,只能找你请教一下。

我前段事件一直用VS2005 C#.NET开发一个wince上应用程序,在这个应用程序中,我需要经常从50000条左右的记录中查询一些符合条件的记录,并进行一些处理,我一直没有找到很合适的方法。前几天我发现WINCE是支持SQL CE的,所以想利用SQL CE数据库来保存我的这些记录,但我目前掌握的知识很少,根本无从下手。我从网上也找了一些例子,困难就出现在我现在连连接数据库都不能实现。

我的部分代码如下:

if (File.Exists("Test.sdf"))
File.Delete("Test.sdf");

string connStr = "Data Source = point.sdf; Password = lovedjkj";

SqlCeEngine engine = new SqlCeEngine(connStr); //此处报错,无法找到 PInvoke DLL“sscemw20.dll”。
engine.CreateDatabase();
engine.Dispose();

SqlCeConnection conn = null;

try
{
conn = new SqlCeConnection(connStr);
conn.Open();

SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "CREATE TABLE myTable (col1 int, col2 ntext)";
cmd.ExecuteNonQuery();
}
catch { }
finally
{
conn.Close();
}

这是MSDN上的例子,我直接拷贝过来都出现错误。这个错误我百思不得其解,我怀疑我是不是错在某些前提条件都还没有做到,急切希望得到你的指点。不胜感激。
...全文
834 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
backup88 2011-05-31
  • 打赏
  • 举报
回复
怎么安装sqlce 2.0?
ywh_hlp 2010-07-15
  • 打赏
  • 举报
回复
最近又遇到sscemw20.dll文件在WINCE6.0上找不到,郁闷!
xugh 2009-02-27
  • 打赏
  • 举报
回复
也要搞wince5的开发,也要用sqlce
关注一下
ll821121 2009-02-07
  • 打赏
  • 举报
回复
能说一下具体安装步骤吗多谢
哈哈潜伏哥 2008-07-24
  • 打赏
  • 举报
回复
谢谢各位,我的问题解决了,谢谢,原来是要在wince设备上安装sqlce才能正常运行的,多谢各位的支持。
我很懒 2008-07-22
  • 打赏
  • 举报
回复
wince写过一段时间。
ericzhangbo1982111 2008-07-22
  • 打赏
  • 举报
回复
ppc的sqlce有视图。所以必需装client的软件。
wince6.0就没有这问题
ericzhangbo1982111 2008-07-22
  • 打赏
  • 举报
回复
你装的sdk里面的下面有一个地方忘记在那了。
有个.cab的文件吧

\SmartDevices\SDK\SQL Server\Mobile\v2.0\wce500\armv4i\
下面有.cab文件,装上
BIGBIRDINWOODS 2008-07-21
  • 打赏
  • 举报
回复
sscemw20.dll是SQL Server CE 2.0中的文件,你先试试在WinCE设备上安装SQL Server CE 2.0... 先把这个搞定再说啊
ericzhangbo1982111 2008-07-21
  • 打赏
  • 举报
回复
确定你是什么的wince开发
pocket pc 2003?
mobile 5.0?
mobile 6.0?

安装sdk以后
确定引用

还是不可以的话 尝试安装.cab的sqlce安装文件

The project included among other references System.Data.SqlServerCe (Version 3.0.x). We also included the following files
* sqlce30.dev.ENU.wce5.x86.CAB
* sqlce30.repl.wce5.x86.CAB
* sqlce30.wce5.x86.CAB
* sscemw20.dll
* System.Data.SqlServerCe.dll (Version 3.0.x)
* System.Data.SqlServerCe.xml (The only xml file that was created in the bin after building the project)
The 'Copy to Output directory' property was set to 'Copy Always' for each of the six items above.


3. On deployment, the application folder on the device contained following files:
* The application exe (dbtest1.exe)
* the 3 cab files above
* sscemw20.dll
* System.Data.SqlServerCe.dll (Version 3.0.x)
* System.Data.SqlServerCe.xml
* A file with name 514c36bf-c13e-4091-a3a7-1e566227b20d and no extension.

On executing the CAB files following files were created (we chose the Windows folder)-
* isqlw30.exe
* sqlceca30.dll
* sqlcecompact30.dll
* sqlceer30EN.dll
* sqlceme30.dll
* sqlceoledb30.dll
* sqlceqp30.dll
* sqlcese30.dll
* GAC_System.Data.SqlServerCe_v3_0_3600_0_cneutral_1.dll
* GAC_System.Data.SqlServerCe.resources_v3_0_3600_0_cen_1.dll

4. We used the Internet Appliance template for the WinCE image and included following components:
* wceload
* network utilities (ipconfig etc)
* .net cf 2.0
We did not include the persistent registry components for the time being. In case it works, we'll do that as well.
We also tried one more thing: We run the query analyzer (isqlw30.exe) to create a new database. The create database dialog reported the following error: 'Failed to initialize the provider. Please make sure that SQL Server Mobile Edition is properly installed.'
Kindly help as soon as possible. Time is running out...

I think the last thing we can do is that you send your nk.bin and the project folder to us. Even if this does not work then your machine is magical!
Bbye!
Coder
哈哈潜伏哥 2008-07-21
  • 打赏
  • 举报
回复
问题还是没有解决,还是报的无法找到sscemw20.dll,不知道怎么办了。

我按vrhero兄弟说的做了一次,结果还是一样,各位大侠,帮忙想想办法吧。

net_lover 给的资料我也看了,关键是我现在连前提条件都不满足,更别说连接数据库了。

错误就是这一句:

SqlCeEngine engine = new SqlCeEngine ("Data Source = \\ MobileService;password=test;encrypt database=TRUE");

无法找到 PInvoke DLL“sscemw20.dll”。

各位大侠再帮帮忙吧。
哈哈潜伏哥 2008-07-21
  • 打赏
  • 举报
回复
我用的WIN CE5.0的设备开发,出现这个错误的。

我就是不知道怎么在WINCE上安装SQL CE。在CE上安装SQL CE是怎么安装的,有没有详细的方法。谢谢
vrhero 2008-07-20
  • 打赏
  • 举报
回复
看一下WinCE设备...多个SQL Server CE版本可能会发生冲突...把它们都删掉重新部署...

最好使用“干净”系统开发...即部署之前硬启动WinCE设备将其初始化...
哈哈潜伏哥 2008-07-20
  • 打赏
  • 举报
回复
不是的,我是用VS2005来部署的,谢谢你,能不能再给点提示
vrhero 2008-07-20
  • 打赏
  • 举报
回复
sscemw20.dll是SQL Server CE 2.0中的文件...也就是说你没有在WinCE设备上安装SQL Server CE 2.0...

用VS2005开发联机部署或调试时会自动安装SQL Server CE 2.0...否则就要手工安装...你不是只把程序copy过去的吧...
哈哈潜伏哥 2008-07-20
  • 打赏
  • 举报
回复
关键问题是我找不到这个文件下载啊,我电脑上没有,网上也下载不了
yagebu1983 2008-07-20
  • 打赏
  • 举报
回复
关注WinCE开发!!!
wuyanteng1 2008-07-20
  • 打赏
  • 举报
回复
没有sscemw20.dll文件,下载个
孟子E章 2008-07-20
  • 打赏
  • 举报
回复
参见
http://hi.baidu.com/qiyun996/blog/item/70a9cbcda0f43f550fb345b1.html
http://develop.csai.cn/mobile/200605151155301165.htm
wwwwpig 2008-07-20
  • 打赏
  • 举报
回复
数据库的路径没写,根是"\"

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧