SQLException while connecting to a SQL Server Database from Windows Mobile

80 Views Asked by At

I'm trying to develope an application for a mobile device. I've tried to do a simple code to open a connection to the database (a SQL Server one) and read a table.

However, on the Open command it throws a SQLException with no message. Here are some screenshots of the emulator:

enter image description here

By pressing "Prueba", I show the connection string, so I can check the data.

enter image description here

Then, the problem:

enter image description here

(the "SQLException" is shown with the "Message" property of the Exception object)

This is the code

try {
  string conexion = Recepcion_compras.Properties.Resources.conexion;                
  SqlConnection con = new SqlConnection(conexion);
  MessageBox.Show(con.ConnectionString);
  con.Open();
} catch(Exception ex) {
  MessageBox.Show("ERROR: " + ex.Message);
}

Connection data are correct and the TCP/IP connection is enabled.

What could be the error?

Thank's in advance

1

There are 1 best solutions below

0
davidrgh On

Ok I answer myself.

The network was not enabled on the emulator configuration -_-