Ver Mensaje Individual
  #23 (permalink)  
Antiguo 04/10/2006, 22:04
Avatar de univercity
univercity
 
Fecha de Ingreso: noviembre-2002
Mensajes: 681
Antigüedad: 22 años, 2 meses
Puntos: 0
Vuelvo a colocar mi codigo completo a ver si algun experto me puede decir cual es mi NOvato error, para ver cual es el resultado hasta ahora http://www.wineup.cl/wineup/ejemplo6.aspx

ese es el codigo:
<%@ Page Language="VB"%>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<html>
<head>

<script runat="server">
Dim MyConnection As OleDbConnection

'Public Class ListBox
'Inherits ListControl
'Implements IPostBackDataHandler
'protected withevents MySelect as System.Web.Ui.WebControls.DropDownList
'protected withevents MyList1 as System.Web.Ui.WebControls.DropDownList

Sub Page_Load(Sender As Object, E As EventArgs)

MyConnection = New OleDbConnection("PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & Server.MapPath("../mmmm/xyz.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 Object, ByVal e As System.EventArgs)
Private Sub MySelect_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
If Not (IsPostBack)
Dim SelectCmd As String = "select * from vinos where (variedad=@Variedad)"
Dim DS As DataSet
Dim MyCommand As OleDbDataAdapter
MyCommand = New OleDbDataAdapter(SelectCmd, MyConnection)
MyCommand.SelectCommand.Parameters.Add(New OleDbParameter("@variedad", SqlDbType.VarChar))
MyCommand.SelectCommand.Parameters("@Variedad").Va lue = MySelect.SelectedValue
DS = New DataSet()
MyCommand.Fill(DS, "vinos")
MyList1.DataTextField="cepa"
MyList1.DataValueField="cepa"
MyList1.DataSource= DS.Tables("vinos").DefaultView
MyList1.DataBind()
end if
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="MyList1"
DataField="cepa"
Rows="4"
Width = "200"
height = "300"
AutoPostBack="True"
SelectionMode="Single"
runat="server"/>

</form>

</body>
</html>
__________________
"Lo importante es nunca dejar de hacerse preguntas"
Albert Einstein

Última edición por univercity; 04/10/2006 a las 22:05 Razón: Se me olvidaba ocultar la base