日期:2014-05-18 浏览次数:20454 次
Private Sub Form_Load() Dim sDsn As String, sSql As String Dim cn As New ADODB.Connection Dim rs As ADODB.Recordset sDsn = "Provider=SQLOLEDB;Server=[服务器名];uid=[帐号];password=[密码]" cn.Open (sDsn) sSql = "select distinct 区块 from qukuai" Set rs = cn.Execute(sSql) Do Until rs.EOF Combo1.AddItem CStr(rs.Fields(0)) rs.MoveNext Loop rs.Close cn.Close Set rs = Nothing Set cn = Nothing End Sub