Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
751 views
in Technique[技术] by (71.8m points)

c# - "Can't find PInvoke DLL 'dbnetlib.dll'." error in Smart Device Application

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...