使用代码连接时可以声明一个ADO对象,然后再打开该对象,在成功的取得数据库,
用如下语句就可以:
Dim rst as ADO.Recordset
rst.Open""
set MSHFlexGrid1.DataSoruce=rst

解决方案 »

  1.   

    用代码实现是个好主意:如下
    dim conn as new adodb.connection,rs as adodb.recordset
    On Error Resume Next
          Conn.Open Connstr$
         Ssql$ = "select useid,usepwd,usesfen from usetest"
            Rs.Open Ssql$, Conn, adOpenForwardOnly, adLockReadOnly
            If Err.Number <> 0 Then MsgBox Err.Description, vbOKOnly + vbExclamation, "error:about": End
       With MSFlexGrid1
                  If Rs.EOF Then .Rows = 3
               While Not Rs.EOF
                   .Col = 1: .Text = Rs("useid") & ""
                   .Col = 2: .Text = Rs("usepwd") & ""
                   .Col = 3: .Text = Rs("usesfen") & ""
               .Rows = .Rows + 1
               .Row = .Row + 1
               Rs.MoveNext
               Wend
                .Rows = .Rows - 1
            End With
      

  2.   

    let me test .  and you will earn your point .    thanks a lot!!!  2 man dou you.   
                                 qiu to ma te!