“找不到PInvoke DLL”dbnetlib.dll'。“智能设备应用程序中的错误 [英] "Can't find PInvoke DLL 'dbnetlib.dll'." error in Smart Device Application

查看:851
本文介绍了“找不到PInvoke DLL”dbnetlib.dll'。“智能设备应用程序中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio Pro 2008中创建一个程序,我正在尝试从我的程序访问SQL数据库。运行程序的设备在Windows CE上运行,它是条码扫描器。当我运行代码并尝试建立与数据库的连接时,我会抛出一个MissingMethodExeption,它说:

 不能找到PInvoke DLL'dbnetlib.dll'。 

从在线提取,我发现你需要安装sql.ppc.we5.armv4i。 cab文件,但是我的设备没有安装它(我的一个问题)。



这是我用来建立与我的SQL数据库的连接的代码。

  string conString =Data Source = OS4DPC05\\SQLEXPRESS; Initial Catalog = testing; Integrated Security = SSPI; User ID = **************;; 
Process.Start(\\ Windows \\wceload.exe,\\Program Files\\SmartDeviceProject2\\sql.ppc.wce5.armv4i.cab );
using(SqlConnection con = new SqlConnection(conString))
{
con.Open();
}

这只是代码的一部分,但程序总是停在con。 Open();



任何人都知道如何解决这个问题?任何建议将不胜感激。

解决方案

我解决我的问题的方法是在我的电脑上找到dbnetlib.dll,并将其放在同一个文件夹中,应用程序正在运行。有不止一个,所以我不断复制不同的版本,直到找到正确的版本。


I am creating a program in Visual Studio Pro 2008, and I am trying to access a SQL database from my program. The device that is running the program is running on Windows CE, and it is a bar code scanner. When I run the code and try to establish a connection to the database, I get thrown a MissingMethodExeption which says:

Can't find PInvoke DLL 'dbnetlib.dll'.

From reseraching online, I found out that you need to instal the sql.ppc.we5.armv4i.cab file, however my device isn't installing it (One of my problems).

Here is the code I am using to establish a connection with my SQL database.

 string conString = "Data Source=OS4DPC05\\SQLEXPRESS;Initial Catalog=testing;Integrated Security=SSPI;User ID=**************;";
 Process.Start("\\windows\\wceload.exe", "'\\Program Files\\SmartDeviceProject2\\sql.ppc.wce5.armv4i.cab'");
        using (SqlConnection con = new SqlConnection(conString))
        {
            con.Open();
        }

That is just part of the code, but the program always stops at con.Open();

Anyone know how to fix this problem? Any suggestions would be much appreciated.

解决方案

The way I solved my problem was I found dbnetlib.dll on my computer and I placed it in the same folder where my application was running from. There was more than one so I kept copying the different versions till I found the right one.

这篇关于“找不到PInvoke DLL”dbnetlib.dll'。“智能设备应用程序中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆