rikakashi Muchas gracias por tanta ayuda y disculpa también por tantas molestias, desafortunadamente sigo con el mismo problema mi listbox1 esta con sus campos pero el 2 se rehúsa a aceptar los campos que le mando
... No se que pasa :s... Aquí dejó el código que puse... De nuevo muchísimas gracias:
Código ASP:
Ver original<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script language="vbscript" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim reader As SqlDataReader
Dim values As ArrayList = New ArrayList()
Dim conn As SqlConnection =
New SqlConnection("server=myhost;database=mydb;User ID=myuser;Password=mypass;Trusted_Connection=no")
Dim sql As String =
"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES GROUP BY TABLE_NAME"
Dim dr As New SqlCommand(sql, conn)
conn.Open()
reader = dr.ExecuteReader()
While reader.Read()
values.Add(reader.Item("TABLE_NAME").ToString())
End While
lb1.DataSource = values
lb1.DataBind()
reader.Close()
End Sub
</script>
<html>
<head>
<title>Tablas y Columnas</title>
</head>
<body>
<asp:Label ID="Label1" runat="server" Text="RPE del Empleado"></asp:Label>
<form id="Form1" method="post" runat="server" name="ListEnlaza">
<asp:ListBox id="lb1" SelectionMode="Multiple" runat="server" Height="217px"
Width="196px"/>
<asp:ListBox id="lb2" SelectionMode="Multiple" runat="server" Height="147px"
Width="196px"/>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="list2"/>
<script language="vbscript" runat="server">
sub list2 (ByVal sender As Object, ByVal e As EventArgs)
Dim reader As SqlDataReader
Dim values2 As ArrayList = New ArrayList()
Dim conn As SqlConnection =
New SqlConnection("server=myhost;database=mydb;User ID=myuser;Password=mypass;Trusted_Connection=no")
conn.Open()
DIM CADENA AS STRING = Convert.ToString(lb1.SELECTEDITEM)
Dim sql2 As String =
"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME =' & CADENA & ' GROUP BY COLUMN_NAME"
Dim dr2 As New SqlCommand(sql2, conn)
reader = dr2.ExecuteReader()
While reader.Read()
values2.Add(reader.Item("COLUMN_NAME").ToString())
End While
lb2.DataSource = values2
lb2.DataBind()
reader.Close()
conn.Close()
End Sub
</script>
</form>
</body>
</html>