Código ASP:
Ver original
<%@ Import Namespace="System.Data.SQLClient" %> <script language="vbscript" runat="server"> Sub Page_Load(Sender As Object, E As EventArgs) 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.COLUMNS GROUP BY TABLE_NAME" Dim sql2 As String = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS GROUP BY COLUMN_NAME" Dim dr As New SqlCommand(sql, conn) Dim dr2 As New SqlCommand(sql2, conn) Dim reader As SqlDataReader Dim values As ArrayList = New ArrayList() Dim values2 As ArrayList = New ArrayList() conn.Open() reader = dr.ExecuteReader() While reader.Read() values.Add(reader.Item("TABLE_NAME").ToString()) End While reader.Close() reader = dr2.ExecuteReader() While reader.Read() values2.Add(reader.Item("COLUMN_NAME").ToString()) End While lb.DataSource = values lb.DataBind() lb2.DataSource = values2 lb2.DataBind() reader.Close() conn.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"> <asp:ListBox id="lb" SelectionMode="Multiple" runat="server" Height="643px" Width="196px"/> <asp:ListBox id="lb2" SelectionMode="Multiple" runat="server" Height="643px" Width="196px"/> </form> </body> </html>
Muchas gracias de antemano, eh buscado pero no he encontrado una solución hasta ahora, de nuevo gracias...