.Net CF 2.0 Error , "Can't find PInvoke DLL 'dbnetlib.dll'."

Category: sql server ce


Jayakumar A on Mon, 16 Jan 2006 05:04:15

Hi All,

I'm developing Pocket Pc application, In that i have set of statement, which establishes connection with sql Server 2000 Database. When ever I try to open SqlConnection, I’m getting error "Can't find PInvoke DLL 'dbnetlib.dll'.". Right now i am working in .Net Compact Framework 2.0 , But previously i worked in .Net CF 1.1 i didn’t face problem while doing that. Can any one help me to solve this issue?

  My code exactly look like :


Private SqlCmd As New SqlCommand

Private SqlTrans As SqlTransaction

Private SqlConn As SqlClient.SqlConnection

Private SqlCmdBuilder As SqlCommandBuilder

Private SqlDataAdapter As SqlDataAdapter

Public Function Select_DocumentTemplate() As DataSetDocumentTemplate

Dim DocuMentTemplateDs As New DataSetDocumentTemplate


SqlConn = New SqlConnection("Data Source=SERVERNAME;Initial Catalog=DATABASENAME;Persist Security Info=True;User ID=sa")

 If SqlConn.State = ConnectionState.Closed Then


End If

 SqlCmd = New SqlCommand

SqlCmd.CommandType = CommandType.StoredProcedure

SqlCmd.CommandText = New StringBuilder(500).Append("Select_documentTemplateDetails").ToString()

SqlCmd.Connection = SqlConn

SqlDataAdapter = New SqlDataAdapter(SqlCmd)

SqlCmdBuilder = New SqlCommandBuilder(SqlDataAdapter)


Return DocuMentTemplateDs

Catch ex As Exception

Throw ex



End Try

End Function

' When Ever I try to call above method to retrive data from Db  , It's giving Missingmethod Exception and error message will be "Can't find PInvoke DLL 'dbnetlib.dll'."

Thanks ,







Ilya Tumanov on Mon, 16 Jan 2006 05:58:20

Please make sure SQL Client CAB is installed on device, you can check in "Remove Programs" applet. If not, please install correct CAB file manually.


CABs can be found in  %ProgramFiles%\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Client\v2.0\"

Jayakumar A on Mon, 16 Jan 2006 06:15:51


Yes, Cab file is not installed , Could you please tell me how to find correct cab File for Intel (R) PXA270 processor. Pocket Pc Model is iPAQ Hx2790.

Thanks ,


Ilya Tumanov on Mon, 16 Jan 2006 17:10:29

It depends on the OS this device is running.

sql.ppc.wce4.armv4.CAB - PPC 2003

sql.phone.wce5.armv4i.CAB - WM 5.0

Rodel E. Dagumampan on Sun, 07 May 2006 04:18:47

Hi I am experiencing the same error and I can't find any resources how to fix this. What did you do to fix this error. I keep on receiving this error when I ported my application to CF 2.0 from Beta 2 using Visual Studio 2005.


Jayakumar A on Tue, 09 May 2006 05:06:51


Hi ,

 This error occurs, when we try to create SQL CE database or Inserting Data into the SQL CE database before loading forms. We can avoid this error if you do that operation after loading Form and other initialization, I was getting that error because I coded that operation in the form load event. And it’s better to use  



Before doing that operations.


Thanks ,

Jayakumar A

museicon on Tue, 28 Nov 2006 18:41:27

Looks like an OS bug to me.  Just moving some code around a bit can cause this problem to appear or disappear.  Also, the only sure fix appears to be a cold boot, i.e., need to reinstall all Cabs.

Bruno Of France on Thu, 11 Jan 2007 13:43:38

The same problem for me but it apear at the db connection. I work on VS2005 under VB with à CE 5.00 on 7535 Psion whith xscale processor.

I don't find the dbnetlib.dll in any dépendance of the file chose for my application cab.

I would like to install the cab of sqlceclient on the device but i don't now who choose for an xscale procesor.

is someone know that thanks!!!


Sorry for my english

Ilya Tumanov on Thu, 11 Jan 2007 19:49:31

XScale is just an ARM variation, so pick ARM CAB file for Windows CE.

Jayakumar A on Fri, 12 Jan 2007 09:30:13

Hi ,

If XScale is just an ARM variation, then you can choose

sql.ppc.wce4.armv4.CAB - PPC 2003

sql.phone.wce5.armv4i.CAB - WM 5.0


Bruno Of France on Fri, 12 Jan 2007 09:37:02

Thanks All, it's work properly now. I have just à problem when i do a cold reset but i think it's because the dll isn't storage in the flash disk. I test that.

Lovelu on Sat, 03 Feb 2007 09:32:30

hi Ilya Tumanov

can you tell me from where i can download "sql.phone.wce5.armv4i.CAB - WM 5.0". and how to install it on PDA.

thanks in advance

Bruno Of France on Mon, 05 Feb 2007 08:36:15

Hi Lovelu

Donwload Microsoft SQL Server 2005 Mobile Edition and install.

You can find it in

C:\Program Files\Microsoft SQL Server 2005 Mobile Edition\Device\Client\v2.0\wce500\ARMV4I


FDSD on Wed, 28 Feb 2007 07:45:22


   I am using windows mobile 5 pocket PC, I installed sql.phone.wce5.armv4i.CAB but still get the error. Any idea?

ErikEJ on Wed, 28 Feb 2007 08:26:37

On Windows Mobile 5 Pocket PC, to install SqlClient, you need to use:



FDSD on Thu, 01 Mar 2007 02:26:31


I have installed sql.ppc.wce5.armv4i.CAB, but i got an error message "PlatformNotSupportedException". Anything that i am missing?

I am using a WIFI handheld terminal operating on windows mobile 5.0 PPC with a program to communicate with SQL Server 2005 which is located in a PC via WIFI.

FDSD on Thu, 01 Mar 2007 04:01:49


I have solved it. The problem is actually the database collation.


kareshi on Wed, 27 Jun 2007 08:12:31

 ErikEJ wrote:

On Windows Mobile 5 Pocket PC, to install SqlClient, you need to use:






I am developing mobile app using VS2003 with .net framework 1.1 for my HP iPAQ hx2490b ( has Compact framework ver1 and 2 installed).


What cab file should I use and where can I get it? I tried to extract the cab file above by running the msi file from here but it seems

that that cab file is not ment for the mobile applications developed with vs 2003.




ErikEJ on Wed, 27 Jun 2007 15:34:32

You must use SQL CE 2.0 if you have to use VS 2003 and .NET CF 1.1. The required cab file is in this location on my system, the location will be similar (I have VS 2005):

C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v2.0\wce400\armv4

The cab file name is: sqlce20.ppc.wce4.armv4


kareshi on Fri, 29 Jun 2007 01:32:03


Hi ErikEJ,


Domo arigatou gozaimasu!!


It worked!!



kareshi on Mon, 02 Jul 2007 07:14:09


Hi ErikEJ,


Just asking how the developers who have used VS 2003 obtained the sqlce20.ppc.wce4.armv4.cab file? Was that file available for download during the pre VS2005 era?

ErikEJ on Tue, 03 Jul 2007 18:51:27

It was included in the file system similar to with SQL Mobile 2005 with VS 2005. Can't remember the exact location. You can also download the device DLLs for version 2.0 from here: http://www.microsoft.com/downloads/details.aspx?familyid=B9B12312-FE57-4817-A4BC-69992802732D&displaylang=en


janols on Wed, 22 Aug 2007 17:14:54


I am a beginner on using PDA's, how do i install files on a PDA?



Saamy _ INDIA _ on Sat, 08 Dec 2007 12:28:35

by using ActiveSync4.5 which is the latest updation of Microsoft you can transfer files between ur PDA and PC

hassaancs on Thu, 13 Dec 2007 07:32:21


I Am facing the same problem. I have MC3070 WiFI with WindowsCE 4 .0 and i Have installed Sql Ce 2.0

I want to connect to Database server through WiFi device But I get an Error "SqlException" on my device when i run my aplication. Kindlly Help me in solving the problem.

Greg59 on Fri, 27 Jun 2008 14:32:51

I have a different problem.  I have VS2005 and SQL Server 2005 installed and getting this error message in the Pocket PC Emulator.  Does anyone know what to do about that?  I've read alot on what to do if you get it on an actual device but not the emulator.



ErikEJ on Sun, 29 Jun 2008 11:35:25

Copy the required cab file to the emulator file system, and click it in File Manager (in the Emulator). 


Greg59 on Mon, 30 Jun 2008 12:38:46

How do I copy something to the emulator file system? I am not sure where that is.

ErikEJ on Mon, 30 Jun 2008 13:04:59

You can use the Remote Tools (Remote File Viewer), or you can cradle the device. Look fro example here:



spaniol on Wed, 09 Jun 2010 06:45:33

hi erikej i am havr=eing the same problem but the diffrence in my case that i am using a thin client  hp compaq t5530 with windows ce 5.0

after days of trying to make the application to even start i got to make it start but my problem now is this same message

while in the windows mobile emulater and on a i mate jaq 3 mobile i have no problems at all

i copied the dbnetlib.dll file every where and still doesnt work

do u have any solution i am realy beginig to get crazy

thank u in advance

spaniol on Sat, 12 Jun 2010 14:15:07

doesnt any one know how to

i am realy depressed

spaniol on Sat, 12 Jun 2010 14:27:46

i found it i finnaly found it its in the

%ProgramFiles%\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Client\v2.0\

there is a x68 folder where there are the appropiate cab files

Jinantha Perera on Fri, 04 Feb 2011 05:03:44



I was able to resolve this after going through this page http://support.microsoft.com/kb/945371


Actually I was installing the wrong SQL CAB file to my emulator. According to the KB article I should use the CAB file from the "C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\Client\wce500\x86".

I copied both, "sql.wce5.x86.CAB" and "dbnetlib.dll" files to my emulator. Install the CAB file and it worked.


I copied x86 as I’m using the Windows CE 5.0 emulator for my developments. My development environment is,

-       Windows 7 Ultimate

-       VS 2005 Professional

-       SQL 2008 Express

-       SQL CE 3.5 SP1


So I hope this would help someone.


Thank you & Regards,


Budi Sandi on Wed, 26 Sep 2012 07:07:03


I have solved it. The problem is actually the database collation.



What kind collaction you use ?

couse i have some problem..


ShareefMo on Mon, 18 Nov 2019 12:01:42

I am also getting the same error while developing a windows mobile  application in visual studio 2008 with windows mobile 5.0 emulator , trying to connect to sql server 2005 ,
Do I need to install the specified cab file or just download it and copy to any specific path (But I don't know the path)..

Please help...
Thanks in advance.