Dim dt As DataTable = Nothing
ComMain.objDBCon = New ComDBConn
dt = ComMain.objDBCon.PFn_QueryDB(Fn_GetTblInfosql)
‘指定值=sql指定字段
Me.ComboBox1.ValueMember = "ROW_ID"
’指定显示列=sql指定字段
Me.ComboBox1.DisplayMember = "TABLE_ID"
‘绑定DataTable
Me.ComboBox1.DataSource = dt
sql:
SELECT ROW_NUMBER() OVER(ORDER BY B.NAME) AS 'ROW_ID',B.NAME AS TABLE_ID FROM SYSOBJECTS B WHERE B.XTYPE = 'U' ORDER BY B.NAME