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