예제 #1
0
 protected void GridDatosRegistro_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try
     {
         GridDatosRegistro.PageIndex = e.NewPageIndex;
         GridDatosRegistro.DataBind();
         //ListarRegistro();
         CargarData();
     }
     catch (Exception ex)
     {
         lblMensaje.Text = ex.Message.ToString();
     }
 }
예제 #2
0
 private void ListarRegistro()
 {
     try
     {
         using (SqlConnection conexi = new SqlConnection(ConfigurationManager.ConnectionStrings["SIA_ConnectionString"].ToString()))
             using (SqlDataAdapter da = new SqlDataAdapter("stp_Listar_Registro", conexi))
             {
                 DataTable tbRegistro = new DataTable();
                 da.SelectCommand.CommandType = CommandType.StoredProcedure;
                 da.Fill(tbRegistro);
                 GridDatosRegistro.DataSource = tbRegistro;
                 GridDatosRegistro.DataBind();
                 Session["Registro"] = tbRegistro;
             }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #3
0
        private void CargarData()
        //{
        //    SQL = "SELECT * FROM registro WHERE  cod_area=@id11  AND  correlativo=@id21";
        //    SqlCommand   comando = new SqlCommand(SQL, conexi);
        //    comando.Parameters.Clear();
        //    comando.Parameters.AddWithValue("@id11", id11);
        //    comando.Parameters.AddWithValue("@id21", id21);
        //    SqlDataAdapter dataAdaptador  = new SqlDataAdapter(comando);
        //    dataAdaptador.Fill(dataTabla);
        //    gridListado.Visible = true;
        //    gridListado.DataSource = dataTabla;
        //    gridListado.DataBind();
        //}
        {
            string id1;
            string id2;

            id1 = TextBox1.Text; id2 = TextBox3.Text;
            SQL = "SELECT codigo,codigocliente,Nombre, descripcion, fecha, ubicacion FROM registro WHERE nombre <> '' and cod_area =" + "'" + id1 + "'" + "  AND correlativo =" + "'" + id2 + "'";
            using (SqlConnection conexi = new SqlConnection(ConfigurationManager.ConnectionStrings["SIA_ConnectionString"].ToString()))
                using (SqlDataAdapter da = new SqlDataAdapter(SQL, conexi))
                {
                    try
                    {
                        System.Data.DataTable tbRegistro = new System.Data.DataTable();
                        da.Fill(tbRegistro);
                        GridDatosRegistro.DataSource = tbRegistro;
                        GridDatosRegistro.DataBind();
                        Session["Registro"] = tbRegistro;
                    }
                    catch (Exception ex)
                    {
                        lblMensaje.Text = ex.Message.ToString();
                    }
                }
            //TextBox1.Text = "";
            //TextBox3.Text = "";
        }