I'm starting in the mobile app, and I have an App that needs to bring all the data from sql server "online", I tried to connect the App to the sql server as if it were a WinForm, and when it is connected to the PC the test smartphone and start debugging, correctly select, insert, update, etc, but when I disconnect it from the pc, and open the App, I want to make a select, and does not do the App, as if it does not was connecting to SQL, is there any different way to connect the App to SQL Server? Here I have an example that I have in the App about a login that I made, and that works for me only when the test smartphone is connected to the PC
ConexionController con = new ConexionController();
cTripleDES decry = new cTripleDES();
SqlConnection miConexion =new SqlConnection( "data source = snare.arvixe.com; initial catalog=logins; user id=******; password= ******");
public int Login(string user, string password)
{
try
{
if (miConexion.State == ConnectionState.Closed)
{
miConexion.Open();
}
SqlCommand comando = new SqlCommand("select email, clave from CrmCustomers where email = '" + user + "'and clave = '" + password + "' ", miConexion);
comando.ExecuteNonQuery();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(comando);
da.Fill(ds, "CrmCustomers");
DataRow DR;
DR = ds.Tables["CrmCustomers"].Rows[0];
if ((user == DR["email"].ToString()) && (password == DR["clave"].ToString()))
{
miConexion.Close();
return 1;
}
else
{
miConexion.Close();
return 2;
}
}
catch (Exception ex)
{
miConexion.Close();
return 3;
}
}