02/10/2006, 09:42
|
| | | Fecha de Ingreso: noviembre-2002
Mensajes: 681
Antigüedad: 22 años, 1 mes Puntos: 0 | |
Aqui esta completo...
<%@ Page Language="VB"%>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<script runat="server">
Dim MyConnection As OleDbConnection
Sub Page_Load(Sender As Object, E As EventArgs)
MyConnection = New OleDbConnection("PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & Server.MapPath("../mmmm/bbbbb.mdb"))
If Not (IsPostBack)
Dim DS As DataSet
Dim MyCommand As OleDbDataAdapter
MyCommand = New OleDbDataAdapter("select distinct variedad from vinos", MyConnection)
DS = new DataSet()
MyCommand.Fill(DS, "vinos")
MySelect.DataTextField= "Variedad"
MySelect.DataValueField ="Variedad"
MySelect.DataSource= DS.Tables("vinos").DefaultView
MySelect.DataBind()
End If
End Sub
Private Sub MySelect_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboForo.SelectedIndexChanged
'Aqui ejecutas la consulta
sql="SELECT * FROM vinos WHERE cepa=" & variedad
Mylistbox.DataTextField= "cepa"
Mylistbox.DataValueField ="cepa"
Mylistbox.DataSource= DS.Tables("vinos")
cboforo.DataBind()
End sub
</script>
</head>
<body>
<form runat="server">
<h3>ListBox AutoPostBack Example</h3>
Select an item from the list box: <br><br>
<asp:ListBox id="MySelect"
DataField="Variedad"
Rows="4"
Width = "200"
height = "300"
AutoPostBack="True"
SelectionMode="Single"
runat="server"/>
<asp:ListBox id="cboforo"
DataField="Variedad"
Rows="4"
Width = "200"
height = "300"
AutoPostBack="True"
SelectionMode="Single"
runat="server"/>
<br><br>
</form>
</body>
</html>
__________________ "Lo importante es nunca dejar de hacerse preguntas"
Albert Einstein |