Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/01/2014, 17:37
th3r0rn
 
Fecha de Ingreso: noviembre-2007
Mensajes: 504
Antigüedad: 16 años, 5 meses
Puntos: 2
Respuesta: Como llenar un combo HTML con sql desde ASP.NET

Ya me quedo asi; gracias por nada xd
Código C#:
Ver original
  1. <select>
  2. <%
  3.     string strCon = @"Server=192.168.16.10\SIO;Uid=SHACHOU;Pwd=shac!7#ser;DataBase=SIAT";
  4.     string QueryTipoVacante = "SELECT PKtipoVacante, TipoVacante FROM CatcTipoVacante";
  5.     ClsFunciones funciones = new ClsFunciones();
  6.     System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(QueryTipoVacante, strCon);
  7.     System.Data.DataTable dt = new System.Data.DataTable();
  8.     da.Fill(dt);
  9.     int count = dt.Rows.Count;
  10.     for (int i = 0; i < count; i++ )
  11.     {
  12.         Response.Write("<option value='" + dt.Rows[i]["PKtipoVacante"] + "'>" + dt.Rows[i]["TipoVacante"] + "</option>");
  13.     }
  14.  
  15.  %>
  16.  
  17.  
  18.  
  19.    </select>