0

We have solution based on Windows Mobile 6.5.3 and use System.Data.SqlClient to connect to our database. Everything works fine until...

After upgrade SQL Server from 2005 Workgroup Edition to 2012 standard we have problem with connections.

Real device can connect to SQL server - application works, but we can't debug project on emulators. This is strange why real device can work on that connection string. When we debug using real device we can connect to db while on emulator, we can't

W spend 2 days on searching solutions with no result.

My SQL Connection looks like

Server=xx.xx.xx.xx\InstanceName,1433;Database=dbName;User Id=userName;Password=password;Connect Timeout=30

When we call SqlConnection.Open() exception occurred.

exception view detail

        using (var sqlConnection = new SqlConnection(DatabaseConstans.ConnectionString))
        {
            sqlConnection.Open();

We did:

  • change default SQL port number to 1433
  • cradle emulator - internet browser test - passed
  • SQL Browser is working
  • we can connect from WinForm application on that connection string

Other settings:

cradle

connection manager

connection settings

Adrian Botor
  • 362
  • 3
  • 17
  • What does "we can connect from WinForm application on that connection string" mean, is the mobile application not a winfom app? Check IP connection to sqlserver using vxUtil or another mobile tool to ping the server. If that fails, for whatever reason, youre connection will not work. Is there a webserver in the same net as the sql server? If so, try Internet Explorer Mobile to open that web server. – josef Jul 31 '15 at 15:23
  • Hi @josef, This means, WinForm application works if we copied connection string. There is IIS, I can connect to IIS welcome page. – Adrian Botor Aug 17 '15 at 20:00

2 Answers2

0

You will need to install SQL Server Management Studio 2008 R2 (a free version is available) to open SQL CE (.SDF) files. On Connect in Object Explorer, it will provide option for SQL Server Compact..., in addition to Database Engine.

Haroldo Gondim
  • 7,725
  • 9
  • 43
  • 62
0

Remove your SQL Instance name (eg SQLEXPRESS) from the Connection string.

In SQL Configuration Manager under TCP/IP Protocols, Clear ALL TCP Dynamic Ports (leave blank). Set TCP Port to 1433 under "IPALL"

So your connection string should look like: Data Source=192.168.1.53,1433;Initial Catalog=dbname;User ID=xxx;Password=xxxxx;"

This worked for me after 2 full days of trying to figure it out.

Neil Hobson
  • 515
  • 1
  • 7
  • 14