well I need to have access since another place (using internet) but I don’t have another PC for I see if this is OK … I do have the connection since here myself computer, but I am going to need if I have a connection since another computer to my database, or do you know any another form? (it is for a windows application)
here my class connection because you watch if it is ok..
namespace Coneccion
{
class Conexion
{
public SqlConnection conectar()
{
SqlConnection con = new SqlConnection(@"Data Source=server,1433;Failover Partner=ip;Initial Catalog=database;Persist Security Info=True;User ID=login; Password=password; Asynchronous Processing=True;TrustServerCertificate=True;Network Library=dbmssocn;Workstation ID=pc;User Instance=False");
return con;
}
public void EjecutarConsulta(SqlCommand comando)
{
comando.Connection.Open(); // abrimos la conexion
comando.ExecuteNonQuery(); // ejecutamos la consulta
comando.Connection.Close(); // y cerramos la conexion
}
}
}
Maybe this code getting some error in another computer.
But rest of the code is OK.