• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1078
  • Last Modified:

Can't find PInvoke DLL 'sqlceme30.dll'

Hello
I apologize for asking but in Windows Mobile I am using code to generate my database.

In my module I have the following declaration:
Public conn As New SqlCeConnection( _
    "Data Source=\My Documents\Warf.sdf")

This is used in a Sub below called:
Public Sub createWarfDB()

In my emulator but not on my iPaq i get the same annoying message:
Can't find PInvoke DLL 'sqlceme30.dll'

I have added the dll file to bin\debug and have attempted to load the dll file
 Dim ipfilename As String = "\bin\debug\sqlceme30.dll"
<DllImport("coredll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Public Function ShowSQLCEME30(ByVal ipfilename As IntPtr) As String

    End Function
I still get the same annoying message:
Can't find PInvoke DLL 'sqlceme30.dll'

Will someone be kind enough to help?
Thanks
Scott
Imports System.Data.SqlServerCe
Imports System.Data
Imports System.IO
Imports System.Runtime.InteropServices
 
Module modDatabase
Public ds As DataSet
 
Dim ipfilename As String = "\bin\debug\sqlceme30.dll"
    <DllImport("coredll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Public Function ShowSQLCEME30(ByVal ipfilename As IntPtr) As String
 
    End Function
    
    Public conn As New SqlCeConnection( _
    "Data Source=\My Documents\Warf.sdf")
 
Public Sub createWarfDB()
        'if database does not exist, create one
        Try
            If Not File.Exists( _
            "\My Documents\Warf.sdf") Then
                Dim sqlEngine As New SqlCeEngine( _
                "Data Source=" & _
                "\My Documents\Warf.sdf")
                sqlEngine.CreateDatabase()
        //More Code
    Catch ex As Exception
            ex.Message.ToString()
        End Try
 End Sub
End Module

Open in new window

0
drspmd
Asked:
drspmd
  • 4
  • 3
3 Solutions
 
alexey_gusevCommented:
have you installed Sql Server CE 3.0 on your emulator? depending on which WM version you're using, it may or may not be installed in the object store by default
0
 
drspmdAuthor Commented:
Hi Alexey

It looks like Sql Server CE 3.5 is installed. Would that be the problem? Is there a work around?

Thanks
Scott
0
 
alexey_gusevCommented:
I'd advise to check what dll you have under Windows folder and also click on Remove Programs in Settings on the emulator.

Why do you think it is installed (just checking possible problems ;) )?
If you've installed SQL Server CE 3.5 on the desktop, it doesn't mean it was installed on the emulator
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
drspmdAuthor Commented:
Hi Alexey

"Why do you think it is installed (just checking possible problems ;) )? "

I went to the emulator and noticed it had SqlServerCompact 3.5 Tools EN, Repl and Core under the Settings->Remove Programs. There was no mention of SQL Server CE 3.0.. Is that what you meant?

Thanks
Scott
0
 
alexey_gusevCommented:
ok, then what is referenced in your app?
0
 
drspmdAuthor Commented:
Hi Alexey

I went back to My Projects->References and noticed the System.Data,SqlServerCe version was 3.0.0.3600.0. I highlighted this and changed the Specific Version from True to False and the version became 3.5.0.0. Now when I click Debug the app runs fine except for a A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll, but the app keeps working. I''m not sure if this is accurate but according to my research:
"it is because of a known issue in .NET CF where the System.SR.dll tries to load ENU resources from the satellite assembly that does not exist before falling back to the embedded resources. These exceptions will not have any effect on the runtime behavior of the application."

So by changing the the Specific Version from true to false it fixed it?

Scott
0
 
alexey_gusevCommented:
yes, that exception is known issue, so I think all should be OK now
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now