| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 376 人关注过本帖
标题:求教vb+accsee
只看楼主 加入收藏
房联
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-7-3
结帖率:0
收藏
已结贴  问题点数:0 回复次数:1 
求教vb+accsee
Private Sub Command1_Click()
Adodc1.ConnectionString = "provider=Microsoft.jet.OLEDB.4.0;Persist security info= False; Data source=" & App.Path & "\fyxx.mdb"
Adodc1.CursorLocation = adUseClient
= adCmdText
Adodc1.RecordSource = "select * from czfy where 区域 = '" & Combo1.Text & "'"
Adodc1.Refresh
End Sub
Private Sub Form_Load()
Dim con As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String
Dim conn As String
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=fyxx.mdb;Persist Security Info=False"
sql = "select 区域 from qy"
rst.Open sql, con, adOpenKeyset, adLockOptimistic
Combo1.Clear
Do While Not rst.EOF
Combo1.AddItem (Trim(rst(0)))
 rst.MoveNext
Loop
rst.Close
con.Close
End Sub
Private Sub MS1_DblClick()
Form3.Show
End Sub
有什么可以优化下的吗?
搜索更多相关主题的帖子: security source False where 
2011-07-04 08:50
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1820
专家分:3681
注 册:2011-3-24
收藏
得分:20 
虽然数据库不是我的强项~
但至少排版可以帮你优化下~

程序代码:
Private Sub Command1_Click()
    Adodc1.ConnectionString = "provider=Microsoft.jet.OLEDB.4.0;Persist security info= False; Data source=" & App.Path & "\fyxx.mdb"
    Adodc1.CursorLocation = adUseClient
     = adCmdText
    Adodc1.RecordSource = "select * from czfy where 区域 = '" & Combo1.Text & "'"
    Adodc1.Refresh
End Sub

Private Sub Form_Load()
Dim con As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String
Dim conn As String

    con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=fyxx.mdb;Persist Security Info=False"
    sql = "select 区域 from qy"
    rst.Open sql, con, adOpenKeyset, adLockOptimistic

    Combo1.Clear

    Do While Not rst.EOF
        Combo1.AddItem (Trim(rst(0)))
        rst.MoveNext
    Loop

    rst.Close
    con.Close

End Sub

Private Sub MS1_DblClick()
    Form3.Show
End Sub


[ 本帖最后由 wube 于 2011-7-8 10:59 编辑 ]

不要選我當版主
2011-07-08 10:56
快速回复:求教vb+accsee
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027004 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved