Ver Mensaje Individual
  #7 (permalink)  
Antiguo 17/01/2005, 09:12
Avatar de xknown
xknown
 
Fecha de Ingreso: diciembre-2004
Ubicación: Cusco - Perú
Mensajes: 2.248
Antigüedad: 19 años, 4 meses
Puntos: 7
Hola, aquí te envío el ejemplo, el nombre de la tabla es foo(id, nombre):

Código:
<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
    Sub Page_Load(sender As Object, e As EventArgs)
        if Not IsPostBack then
            Dim command as new OleDbCommand("select id, nombre from foo", _
                new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("bd2.mdb")))
            command.Connection.Open()
            ddlDepartaments.DataTextField = "Nombre"
            ddlDepartaments.DataValueField = "ID"
            ddlDepartaments.DataSource=command.ExecuteReader(CommandBehavior.CloseConnection)
            ddlDepartaments.DataBind()
        End If
    End Sub
</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <asp:DropDownList id="ddlDepartaments" runat="server"></asp:DropDownList>
    </form>
</body>
</html>
Saludos
__________________
Alex Concha
Buayacorp - Programación y Diseño