Showing posts with label mobile. Show all posts
Showing posts with label mobile. Show all posts

Sunday, March 11, 2012

Could not load type 'System.Data.SqlServerCe.SqlCeDataAdapter' from assembly 'System.Data.Sql

Hi,

I am trying to make a mobile application work, but I get the following error. The operating system on Pocket PC is Microsoft? Windows Mobile? 2003 Second Edition. Any ideas? Thanks in advance.

The followings are the error and my codes:

System.TypeLoadException was unhandled
Message="Could not load type 'System.Data.SqlServerCe.SqlCeDataAdapter' from assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91'."
StackTrace:
at SQLMobile.Form1.Form1_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at SQLMobile.Form1.Main()

Codes:

Private Sub FillGrid()

Dim filename As New String _

("\Program Files\SQLMobile\sqlmobile.sdf")

Dim conn As New SqlCeConnection("Data Source=" + filename)

Dim selectCmd As SqlCeCommand = conn.CreateCommand()

selectCmd.CommandText = "select Destination from flightdata"

Dim adp As New SqlCeDataAdapter(selectCmd)

Dim ds As New DataSet()

adp.Fill(ds)

DataGrid1.DataSource = ds

End sub

First, make sure the version of the System.Data.SqlServerCe is the correct one for Compact Framework 2.0 (not the CF1 version which only works with SQL CE 2.0)

Next, uninstall then reinstall SQL Mobile CABs on your device.

Finally, don't use the SqlCeDataAdaper to populate that DataSet - it is the absolute slowest option! Use either the SqlCeDataReader or the SqlCeResultSet to do so.

Darren

Could not load file or assembly 'System.Data.SqlServerCe'...

I am trying to use SQL Mobile 2005 with Visual Studio 2005. I have a simple sql mobile db i created and am trying to test connectivity to the DB in a simple app. I added the reference to the SqlServerCE and the verison # that is shown in properties is 3.0.3600.0, but when i look at the physical DLL in explorer (found at C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0) the version # is 3.0.5206.0, so when i compile and run the test, I get :
System.IO.FileLoadException: Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) > System.IO.FileLoadException: Could not load file or assembly 'System.Data.SqlServerCe, Version=3.0.3600.0, Culture=neutral, PublicKeyToken=3be235df1c8d2ad3, Retargetable=Yes' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).

I have uninstalled visual studio and reinstalled thinking I had a driver issue because I had beta products installed, but I get the same result. I am at a loss of what to do about this.
Hi Mike,

Which project you are working on?
PPC2003/PPC2005/SPH2005/WCE42/WCE50/WIN32

Also is it the device or emulator?

Can you try installing VS 2005 on a very clean machine (no uninstalls and installs) and see if it repros. Basically we want to figure out whether it is a setup issue or a functional issue.

Thanks,
Laxmi NRO, MSFT, SQL Mobile, Microsoft Coporation|||I seemed to have narrowed down the issue. I am using PPC 2005 btw.
The above error occurs if I am using the built in Unit Testing in Team Edition. If i strip out that stuff and just have a simple connection object (outside a test harness) it works fine. Has anyone been able to do TDD using win mobile and sql mobile 2005?|||

UT is not supported for devices, so the answer is no.

|||

Ilya Tumanov wrote:

UT is not supported for devices, so the answer is no.

well that is garbage. anyway, for this example i wasn't testing anything using mobile, just a simple sql mobile connection.|||

Hi,

I have developed a project for Pocket PC 2003 and when i install that to device HP 2200, then its shows error.

Error: File or Assembly : system.data.sqlserverce version 3.0.3600.0 Token No." " or one of its dependencies not found.

Please tell me how can i remove this error. I am using .Net 2.0 pocket pc 2003 for developing the project. Please send me the answer as soon as possible and at my ID thats given below......................................

Thanks

Shalabh Gupta

shalabhgupta16@.hotmail.com

shalabhgupta16@.yahoo.com