예제 #1
0
        public DataSet descendente(string descendente)
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            DataSet       daSet    = new DataSet();

            if (descendente == "CodLibro")
            {
                SqlCommand comando = new SqlCommand("pa_Codldsc", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter adapter = new SqlDataAdapter(comando);
                adapter.Fill(daSet, "Libros");
                conexion.Close();
            }
            else if (descendente == "NomLibro")
            {
                SqlCommand comando = new SqlCommand("pa_NomLibrodsc", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter adapter = new SqlDataAdapter(comando);
                adapter.Fill(daSet, "Libros");
                conexion.Close();
            }
            else if (descendente == "CodEdit")
            {
                SqlCommand comando = new SqlCommand("pa_CodEditdsc", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter adapter = new SqlDataAdapter(comando);
                adapter.Fill(daSet, "Libros");
                conexion.Close();
            }
            return(daSet);
        }
예제 #2
0
        public SqlDataAdapter Actualizar()
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            SqlCommand    comando  = new SqlCommand("pa_MostrarLibro", conexion);

            comando.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter adapter = new SqlDataAdapter(comando);

            return(adapter);
        }
예제 #3
0
        public SqlDataAdapter ActualizarDatos()
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            SqlCommand    comando  = new SqlCommand("pa_Consultar", conexion);

            comando.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter adaptador = new SqlDataAdapter(comando);

            return(adaptador);
        }
예제 #4
0
        public DataSet mostrarLibros()
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            SqlCommand    comando  = new SqlCommand("pa_MostrarLibro", conexion);

            comando.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter adapter = new SqlDataAdapter(comando);
            DataSet        daset   = new DataSet();

            adapter.Fill(daset, "Libros");
            conexion.Close();
            return(daset);
        }
예제 #5
0
        public DataSet combo(string editorial)
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            DataSet       daset    = new DataSet();
            SqlCommand    comando  = new SqlCommand("pa_Com", conexion);

            comando.CommandType = CommandType.StoredProcedure;
            SqlParameter parametro = new SqlParameter("@nombre", SqlDbType.Text);

            comando.Parameters.Add(parametro).Value = editorial;
            SqlDataAdapter adapter = new SqlDataAdapter(comando);

            adapter.Fill(daset, "Libros");
            conexion.Close();
            return(daset);
        }
예제 #6
0
        public DataSet mostrarInicial(string inicial)
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            SqlCommand    comando  = new SqlCommand("pa_Inicial", conexion);

            comando.CommandType = CommandType.StoredProcedure;
            SqlParameter parametro = new SqlParameter("@Pincial", SqlDbType.Text);

            comando.Parameters.Add(parametro).Value = inicial;
            SqlDataAdapter adaptador = new SqlDataAdapter(comando);
            DataSet        data      = new DataSet();

            adaptador.Fill(data, "Libros");
            conexion.Close();
            return(data);
        }
예제 #7
0
        public DataSet comboNombre(string editorial)
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            DataSet       daset    = new DataSet();

            if (editorial == "McGraw-Hill")
            {
                SqlCommand comando = new SqlCommand("pa_McGrawH", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                SqlParameter parametro = new SqlParameter("@Codigo", SqlDbType.Int);
                comando.Parameters.Add(parametro).Value = 1;
                SqlDataAdapter adapter = new SqlDataAdapter(comando);
                adapter.Fill(daset, "Libros");
                conexion.Close();
            }
            else if (editorial == "Prentice Hall")
            {
                SqlCommand comando = new SqlCommand("pa_PrenticeH", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                SqlParameter parametro = new SqlParameter("@codigo", SqlDbType.Int);
                comando.Parameters.Add(parametro).Value = 2;
                SqlDataAdapter adapter = new SqlDataAdapter(comando);
                adapter.Fill(daset, "Libros");
                conexion.Close();
            }
            else if (editorial == "Kimpres")
            {
                SqlCommand comando = new SqlCommand("pa_Kimpres", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                SqlParameter parametro = new SqlParameter("@Codigo", SqlDbType.Int);
                comando.Parameters.Add(parametro).Value = 3;
                SqlDataAdapter adapter = new SqlDataAdapter(comando);
                adapter.Fill(daset, "Libros");
                conexion.Close();
            }
            else if (editorial == "Eni")
            {
                SqlCommand comando = new SqlCommand("pa_Eni", conexion);
                comando.CommandType = CommandType.StoredProcedure;
                SqlParameter parametro = new SqlParameter("@Codigo", SqlDbType.Int);
                comando.Parameters.Add(parametro).Value = 4;
                SqlDataAdapter adapter = new SqlDataAdapter(comando);
                adapter.Fill(daset, "Libros");
                conexion.Close();
            }
            return(daset);
        }
예제 #8
0
        public DataSet mostrarNombre(ref ComboBox cbnombre)
        {
            SqlConnection conexion = ConexionBaseDatos.obtenerConexion();
            SqlCommand    comando  = new SqlCommand("pa_CNombre", conexion);

            comando.CommandType = CommandType.StoredProcedure;
            SqlDataReader leer = comando.ExecuteReader();

            while (leer.Read())
            {
                cbnombre.Items.Add(leer["NomEdit"]).ToString();
            }
            DataSet set = new DataSet();

            leer.Close();
            return(set);
        }