Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/09/2006, 09:55
Emerald
 
Fecha de Ingreso: mayo-2006
Mensajes: 243
Antigüedad: 18 años, 1 mes
Puntos: 0
Pregunta Problema con SqlDataReader

Hola!

Tengo un DropDownList que lleno con los datos de un StoredProcedure de SQL, pero siempre se "come" el primer registro del resultado del stored, no que se que esté pasando.. aqui esta mi código...

Código:
SqlConnection sqlConexionGral = null; 
SqlCommand sqlComandoGral = null; 
SqlDataReader rsGral = null;

string strConnGral = System.Configuration.ConfigurationSettings.AppSettings["Conexion"]; 
sqlConexionGral = new SqlConnection((String) strConnGral);
sqlComandoGral = new SqlCommand();

// Abrirmos la conexion
sqlConexionGral.Open();

// Comenzamos a preparar los comandos
sqlComandoGral.Connection = sqlConexionGral;

// Comenzamos a preparar los comandos
sqlComandoGral.CommandText = " LstPais";
sqlComandoGral.CommandType = CommandType.Text;
rsGral=sqlComandoGral.ExecuteReader();
if (rsGral !=null && rsGral.HasRows )
{
	if (rsGral.Read())
	{
		ddlPais.DataSource = rsGral;
		ddlPais.DataTextField = "Nombre";
		ddlPais.DataValueField = "PaisId";
		ddlPais.DataBind();
		if (!PaisId.Equals("0"))
		{
			ddlPais.Items.FindByValue(PaisId).Selected = true;
		}
	}
}
Heeeelp!!!