日期:2014-05-17 浏览次数:20406 次
Function GetRows(ByVal tablename As String) As ArrayList
Dim arrRows As New ArrayList
Dim dr = BASE.getReader("select * from " & tablename)
Dim schemaTable As DataTable = dr.GetSchemaTable()
Dim MaxFields As Integer = schemaTable.Rows.Count
For j = 0 To MaxFields - 1
Dim ColumnName = schemaTable.Rows.Item(j)("columnname")
Dim Value = GetCode(ColumnName)
arrRows.Add(New ListItem(ColumnName, Value))
Next
BASE.closeReader(dr)
Return arrRows
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
DropDownList1.DataSource = GetRows("t_Projects")
DropDownList1.DataValueField = 字段不知道是什么,只知道这是第一个值(上面的ColumnName),这里写什么
DropDownList1.DataTextField = 字段不知道是什么,只知道这是第二个值(上面的Value),这里写什么
DropDownList1.DataBind()
End If
End Sub