Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/02/2010, 11:22
Solmar
 
Fecha de Ingreso: mayo-2009
Mensajes: 76
Antigüedad: 15 años
Puntos: 0
Referecia a objeto no establecidacomo instancia

hol a todoa nuevamente por aca con la siguiente duda con la cual llevo varios dias sucede que tengo una consulta la cual en el form debe de ir mostrando fila por fila eso he logrado hacerlo con el siguinete codigo:
es imporntante decir que la consulta regresa solo las clavesprimarias perodentro del table adapter cargo cada consulta para queel usuario pueda ver la informacion clara.
le dejo el codigo que tengo using System;

El errorque marca es que referencia a objeto no esta establecida como instacia del objeto
no comprendoa un por que sucede esto si la consulta cargada en el tableadapter es muy similar a las otras que no marcan nimgun errorles dejo el codigo por favos hechenme una ayudita

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class insertadatosprogramados: System.Web.UI.Page
{
int fila;

protected void Page_Load(object sender, EventArgs e)
{


Response.Cache.SetCacheability(HttpCacheability.Se rverAndNoCache);
Response.Cache.SetAllowResponseInBrowserHistory(tr ue);
Response.Cache.SetNoStore();

//AppDomain.CurrentDomain.BaseDirectory;

//this.Session.Add("id_depto",1);
if (!this.IsPostBack)
{
fila = 0;

this.HiddenField1.Value = fila.ToString();
// this.HiddenField2.Value = fila2.ToString();//
}
}

protected void Button1_Click(object sender, EventArgs e)
{
fila = Int32.Parse(this.HiddenField1.Value);
fila++;
this.HiddenField1.Value = fila.ToString();
etiquetas();
//Response.Redirect("insertadatosprogramados.aspx?fi la=" + (++fila));



}

protected void numfila()
{
/*else
fila = Int32.Parse(this.Request["fila"]);*/
}

protected void DropDownList1_DataBound(object sender, EventArgs e)
{
etiquetas();
}
protected void etiquetas()
{
recorreTableAdapters.DataTable5TableAdapter z = new recorreTableAdapters.DataTable5TableAdapter();
// DataView y;
recorre.DataTable5DataTable w = new recorre.DataTable5DataTable();
int es, ob, ac,obes;

// y = (DataView)ObjectDataSource2.Select();
z.Fill(w, Int32.Parse(this.plan.SelectedValue), Int32.Parse(this.Session["id_depto"].ToString()));
//z.Fill(w, 7, Int32.Parse(this.Session["id_depto"].ToString()));
if (w.Count > 0)
{
// num_est = Int32.Parse((w.Rows[fila].ItemArray[0].ToString));

es = Int32.Parse(w.Rows[fila].ItemArray[0].ToString());
ob = Int32.Parse(w.Rows[fila].ItemArray[1].ToString());
ac = Int32.Parse(w.Rows[fila].ItemArray[2].ToString());
obes = Int32.Parse(w.Rows[fila].ItemArray[1].ToString());


estrategia.Text = z.estrategia(es).ToString();
objetivo.Text = z.objetivo(obes).ToString();
accion.Text = z.accion(ac).ToString();
objest.Text = z.objetivo(obes).ToString();// eerror lo regresa en esta linea

//actividades.Text = z.actividades(act).ToString();



}
else
{

estrategia.Text = " ";
objetivo.Text = " ";
accion.Text = " ";

}
if (fila >= w.Count - 1)
Button1.Enabled = false;
else
Button1.Enabled = true;
}



protected void plan_SelectedIndexChanged(object sender, EventArgs e)
{
fila = 0;
this.HiddenField1.Value = fila.ToString();
etiquetas();

}

protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("prubareco.aspx");
}
protected void HiddenField1_ValueChanged(object sender, EventArgs e)
{

}
}