标题:求助~如何将下面语句改成 SQL 语句~红色部分
只看楼主
admin73896
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2014-5-9
结帖率:81.82%
已结贴  问题点数:10 回复次数:2 
求助~如何将下面语句改成 SQL 语句~红色部分
Private Sub Form_Load()
    Dim rs As Object
    sql = "select * from 车辆档案 "
    connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VB数据\db1.mdb;Persist Security Info=False"
      Set rs = CreateObject("ADODB.Recordset")
              'strRS = "select ID,Use_Name,Use_tel,Address,ClientName,Use_mem from KHtable  order by ID DESC"
    sql = "select * from 车辆档案"
    rs.Open strRS, conn, 0, 1
   
    If Adodc2.Recordset.RecordCount = 0 Then Exit Sub
    For i = 0 To Adodc2.Recordset.RecordCount - 1
        Combo1.AddItem Adodc2.Recordset.Fields(0).Value
        Adodc2.Recordset.MoveNext
    Next
   
    Adodc3.RecordSource = "select * from 车辆档案"
    Adodc3.Refresh
   
    If Adodc3.Recordset.RecordCount = 0 Then Exit Sub
    For i = 0 To Adodc3.Recordset.RecordCount - 1
        Combo2.AddItem Adodc3.Recordset.Fields(0).Value
        Adodc3.Recordset.MoveNext
    Next
    On Error Resume Next
    Combo1.Text = Adodc1.Recordset.Fields(1)
    Combo2.Text = Adodc1.Recordset.Fields(2)

End Sub
搜索更多相关主题的帖子: Object False 如何 
2014-06-03 10:28
alike123
Rank: 6Rank: 6
等 级:侠之大者
威 望:8
帖 子:107
专家分:428
注 册:2014-2-10
得分:10 
Dim sql As String
Combo1.Clear
sql = "select * from 车辆档案"
rs.Open sql, connstr, 3, 3
Do While Not rs.EOF
    Combo1.AddItem rs.field(0)
    rs.MoveNext
Loop
rs.Close
2014-06-03 10:58
alike123
Rank: 6Rank: 6
等 级:侠之大者
威 望:8
帖 子:107
专家分:428
注 册:2014-2-10
得分:0 
放在combo1的gotfocus方法下
2014-06-03 11:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-432402-1-1.html




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

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