Monday, March 19, 2012

Help about running SQL CE on Win CE 4.2

Hi everybody,

I developed mobile programs for WM5.0 with C#.NET using SQL Mobile. (Visual Studio 2005, SQL Server 2005 Mobile, Mobile SDK)

But I couldn't run SQL CE on WinCE 4.2 ? (Visual Studio 2003, SQL Server 2000 CE). For example on emulator, an Insert command is running successfully. But on device (Intermec CK 31) we are getting error.

Here is my code :

using System;

using System.Data;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data.SqlServerCe;

namespace UmurBS.Forms.BasimSayimForms

{

publicclass bsEkleForm : System.Windows.Forms.Form

{

private System.Windows.Forms.DataGrid dg;

private System.Windows.Forms.Button button1;

private System.Data.SqlServerCe.SqlCeConnection sqlceconn;

privatestring connstr = "DATA SOURCE = UmurDB.sdf";

public bsEkleForm()

{

InitializeComponent();

}

protectedoverridevoid Dispose( bool disposing )

{

base.Dispose( disposing );

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

privatevoid InitializeComponent()

{

this.button1 = new System.Windows.Forms.Button();

this.dg = new System.Windows.Forms.DataGrid();

//

// button1

//

this.button1.Location = new System.Drawing.Point(160, 264);

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// dg

//

this.dg.Location = new System.Drawing.Point(8, 8);

this.dg.Size = new System.Drawing.Size(224, 200);

this.dg.Text = "dg";

//

// bsEkleForm

//

this.ClientSize = new System.Drawing.Size(237, 291);

this.Controls.Add(this.dg);

this.Controls.Add(this.button1);

this.Text = "bsEkleForm";

}

#endregion

privatevoid button1_Click(object sender, System.EventArgs e)

{

sqlceconn = new System.Data.SqlServerCe.SqlCeConnection(connstr);

this.ekle();

}

privatevoid ekle()

{

try

{

SqlCeCommand cmd = new SqlCeCommand("insert into test (testValue) values ('hi world')", sqlceconn);

sqlceconn.Open();

int rowsaffected = cmd.ExecuteNonQuery();

}

catch(Exception exc)

{

MessageBox.Show(exc.Message);

}

finally

{

if (sqlceconn != null)

if (sqlceconn.State == ConnectionState.Open)

sqlceconn.Close();

}

}

}

}

Any idea ?

Regards

Serkan

In order to run SQL Mobile on WinCE 4.2 devices, you will have to request the following hotfix from Microsoft: http://support.microsoft.com/default.aspx/kb/924811

Hope this assists.

|||

Hi Erik

Actually I don't understand what must I do? Which files I must download? I have an Intermec CK 31 mobile device.

When I install CF 2.0 SP1 on it, I getting "not compatible" error. But completing install. But application does not run. :(

Thanks for any help , suggesstions.

Regards

Serkan

|||Which processsor architecture is your Intermec device based on - you must load the corresponding cabs for both .NET CF and SQL CE.|||

Hi Erik,

Processor is Intel XScale PXA255, 400 MHz . I think Architecture is ARM4.

|||

You need to call Microsoft support for the hotfix, for your Intermec device, you need to request the following files:

For ARMV4i-based devices

File name File version File size Date TimeSqlce30.dev.enu.wce4.armv4i.cabNot Applicable302,36802-Apr-200615:14Sqlce30.repl.wce4.armv4i.cabNot Applicable727,81902-Apr-200615:14Sqlce30.wce4.armv4i.cabNot Applicable1,586,50102-Apr-200615:14

as the only cab files made available for Windows CE 4.2 are for PocketPC devices, not general Windows CE 4.2 Devices.

ie: sqlce30.ppc.wce4.armv4.CAB, sqlce30.repl.ppc.wce4.armv4.CAB, sqlce30.dev.ENU.ppc.wce4.armv4.CAB

You may need to have a look at this as well: http://support.microsoft.com/kb/914829/

No comments:

Post a Comment