Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/01/2011, 08:53
esclavo_del_poder
 
Fecha de Ingreso: agosto-2009
Mensajes: 51
Antigüedad: 14 años, 8 meses
Puntos: 0
Duda Variable ListItem y (datarow a gridviewrow)

public ListItemCollection SubCategorias(string li, string lf)
{
sql = "SELECT [Cod_Categoria], [Nom_Categoria] FROM [M_Categorias] WHERE (Cod_Categoria >="+Convert.ToInt32(li)+") AND (Cod_Categoria <= "+Convert.ToInt32(lf)+")";
comand = new SqlCommand(sql, con);

ListItemCollection col = new ListItemCollection();

reader = comand.ExecuteReader();

try
{

while (reader.Read())
{
col.Add(new ListItem(reader[1].ToString(), reader[0].ToString()));/ /DUDA ACA

}
return col;

}
catch (Exception)
{

throw;
}
finally
{
con.Close();
}
}

Mi pregunta seria pq NO es necesario una variable de tipo Listem para el metodo add del listitemcollection osea pq solo basta con la instancia de un Listitem??

y la otra como convierto un datarow a un gridviewrow, es posible????

Gracias de antemano.