コード例 #1
0
ファイル: CADPaises.cs プロジェクト: Biciua/biciua2
        public void ModificarPais(ENPaises p)
        {
            ENPaises ps=p;
            SqlConnection a = new SqlConnection(cadenaConexion());
            try
            {
                a.Open();
                SqlCommand com = new SqlCommand("Update Paises set iso='" + ps.IsoPais + "',nombre='" + ps.NombrePais + "where Id='" + ps.IdPais + "'", a);

                com.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            finally
            {
                a.Close();
            }
        }
コード例 #2
0
ファイル: CADPaises.cs プロジェクト: Biciua/biciua2
        public void BorrarPais(ENPaises p)
        {
            ENPaises ps=p;
            SqlConnection a = new SqlConnection(cadenaConexion());
            try
            {
                a.Open();
                SqlCommand com = new SqlCommand("Delete from Paises where Id='" + ps.IdPais + "'", a);

                com.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            finally
            {
                a.Close();
            }
        }
コード例 #3
0
ファイル: CADPaises.cs プロジェクト: Biciua/biciua2
        public void InsertarPais(ENPaises p)
        {
            ENPaises ps = p;
            SqlConnection a = new SqlConnection(cadenaConexion());
            try
            {
                a.Open();
                SqlCommand com = new SqlCommand("Insert Into Paises (iso,nombre) VALUES ('" + ps.IsoPais + "','" + ps.NombrePais + "')", a);

                com.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            finally
            {
                a.Close();
            }
        }
コード例 #4
0
ファイル: CADPaises.cs プロジェクト: Biciua/biciua2
 public ArrayList ObtenerIsos()
 {
     SqlConnection a = new SqlConnection(cadenaConexion());
     ArrayList lista = new ArrayList();
     try
     {
         a.Open();
         SqlCommand com = new SqlCommand("Select iso from paises", a);
         SqlDataReader dr = com.ExecuteReader();
         while (dr.Read())
         {
             ENPaises p = new ENPaises();
             lista.Add(dr["iso"].ToString());
         }
         dr.Close();
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
     finally
     {
         a.Close();
     }
     return lista;
 }
コード例 #5
0
ファイル: CADPaises.cs プロジェクト: Biciua/biciua2
        public ENPaises ObtenerPaisPorId(int id)
        {
            ENPaises p = new ENPaises();
            SqlConnection a = new SqlConnection(cadenaConexion());
            try
            {
                //ystem.Diagnostics.Debug.WriteLine("estamos den del try en el cad y el email es "+email);
                a.Open();
                SqlCommand com = new SqlCommand("Select * from paises where Id='" + id + "'", a);
                SqlDataReader dr = com.ExecuteReader();
                //System.Diagnostics.Debug.WriteLine("Select * from clientes where Email='" + email + "'");
                if (dr.Read())
                {
                    //System.Diagnostics.Debug.WriteLine("siii hay resultado ");
                    p.IdPais = int.Parse(dr["Id"].ToString());
                    p.NombrePais = dr["Nombre"].ToString();
                    p.IsoPais = dr["iso"].ToString();

                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("no hay resultado ");
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            finally
            {
                a.Close();
            }
            return p;
        }