ADO? DAO?
控件绑定?不用数据库控件?
你总得有个方案吧。

解决方案 »

  1.   

    我就是学学。没有什么方案,ADO? DAO?
    控件绑定?不用数据库控件?我都不会。
    那就这样吧,给我来个简单的,适合初学者的。
    怎么样啊?
      

  2.   

    VERSION 5.00
    Begin VB.Form main 
       Caption         =   "邮政编码查询系统"
       ClientHeight    =   3465
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   4740
       LinkTopic       =   "Form1"
       ScaleHeight     =   3465
       ScaleWidth      =   4740
       StartUpPosition =   3  '窗口缺省
       Begin VB.ComboBox shx 
          Height          =   300
          Left            =   2280
          TabIndex        =   2
          Top             =   1320
          Width           =   1815
       End
       Begin VB.ComboBox shsh 
          Height          =   300
          Left            =   2280
          TabIndex        =   0
          Top             =   360
          Width           =   1815
       End
       Begin VB.Label yb 
          Height          =   255
          Left            =   2040
          TabIndex        =   5
          Top             =   2280
          Width           =   2055
       End
       Begin VB.Label Label1 
          AutoSize        =   -1  'True
          Caption         =   "请选择省/市:"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   240
          Left            =   360
          TabIndex        =   4
          Top             =   360
          Width           =   1680
       End
       Begin VB.Label Label3 
          AutoSize        =   -1  'True
          Caption         =   "邮政编码为:"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   240
          Left            =   360
          TabIndex        =   3
          Top             =   2280
          Width           =   1545
       End
       Begin VB.Label Label2 
          AutoSize        =   -1  'True
          Caption         =   "请选择市/县:"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   240
          Left            =   360
          TabIndex        =   1
          Top             =   1320
          Width           =   1680
       End
    End
    Attribute VB_Name = "main"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private Sub Form_Load()
        Dim mrc As ADODB.Recordset
        shx.Enabled = False
        yb.Caption = ""
        txtSQL = "select distinct province from code"
        Set mrc = ExecuteSQL(txtSQL)
        If Not mrc.EOF Then
            Do While Not mrc.EOF
                shsh.AddItem mrc.Fields(0)
                mrc.MoveNext
            Loop
        End If
        mrc.Close
    End SubPrivate Sub shsh_Click()
        Dim mrc As ADODB.Recordset
        txtSQL = "select city from code where province='" & Trim(shsh.Text) & "'"
        shx.Clear
        shx.Text = ""
        shx.Enabled = True
        yb.Caption = ""
        Set mrc = ExecuteSQL(txtSQL)
        If Not mrc.EOF Then
            Do While Not mrc.EOF
                shx.AddItem mrc.Fields(0)
                mrc.MoveNext
            Loop
        End If
        mrc.Close
    End SubPrivate Sub shx_Change()
        Dim mrc As ADODB.Recordset
        txtSQL = "select city from code where province='" & Trim(shsh.Text) & "'"
        shx.Text = ""
        shx.Clear
        shx.Enabled = True
        yb.Caption = ""
        Set mrc = ExecuteSQL(txtSQL)
        If Not mrc.EOF Then
            Do While Not mrc.EOF
                shx.AddItem mrc.Fields(0)
                mrc.MoveNext
            Loop
        End If
        mrc.Close
    End SubPrivate Sub shx_Click()
        Dim mrc As ADODB.Recordset
        txtSQL = "select pcode from code where province='" & Trim(shsh.Text) & "'" & " and " & "city= '" & Trim(shx.Text) & "'"
        Set mrc = ExecuteSQL(txtSQL)
        yb.Caption = mrc.Fields(0)
        
    End Sub
      

  3.   

    楼上的写的是什么啊?我看 不明白啊。谢谢 oxfordxyc(石头) !
      

  4.   

    www.vbcode.com自己找吧,有很多源代码.
      

  5.   

    vb6+access2000要加sp5
    你可以到www.codegproject.com 看一看,比较全
      

  6.   

    安装SP5吧,很简单的:
    DIM DB AS DAO.DATABASE
    DIM RST AS DAO.RECORDSET
    SET DB=DBENGINE.OPENDATABASE("数据库名称")
    set rst=db.openrecordset("SELECT * FROM 表名",dbopendynaset)
    引用RST就可以了.
    注意:在可视化数据库引擎中不能使用ASCEE2000数据库
      

  7.   

    一个连接,一个打开存到数据集~(ADO)