Ver Mensaje Individual
  #25 (permalink)  
Antiguo 09/10/2006, 02:12
Avatar de univercity
univercity
 
Fecha de Ingreso: noviembre-2002
Mensajes: 681
Antigüedad: 22 años, 1 mes
Puntos: 0
No hay caso...

De nuevo el codigo completo a ver si alguien me puede ayudar...
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace = "System.Web.Ui.WebControls.ListControl" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<html>
<head>

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

protected withevents MySelect as System.Web.Ui.WebControls.ListBox

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
'
'Inherits ListControl
'Implements IPostBackDataHandler

'protected withevents MyList1 as System.Web.Ui.WebControls.ListControl

MyConnection = New OleDbConnection("PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & Server.MapPath("../yugh/vggrd.mdb"))

If Not (IsPostBack) Then
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

Protected Sub MySelect_SelectedIndexChanged(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles MySelect.SelectedIndexChanged



Dim variedad As String
variedad = MySelect.SelectedItem.Text
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 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"
DataValueField="Variedad"
Rows="4"
Width = "200"
height = "300"
AutoPostBack="True"
SelectionMode="Single"
runat="server"/>


<asp:ListBox id="MyList1"
DataValueField="Cepa"
Rows="4"
Width = "200"
height = "300"
AutoPostBack="True"
SelectionMode="Single"
runat="server"/>


</form>

</body>
</html>
Para ver el error que esta enviando:
http://www.wineup.cl/wineup/ejemplo6.aspx
__________________
"Lo importante es nunca dejar de hacerse preguntas"
Albert Einstein