| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 748 人关注过本帖, 1 人收藏
标题:查询ACCESS中数据的问题
只看楼主 加入收藏
whshans
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-11-26
收藏(1)
 问题点数:0 回复次数:1 
查询ACCESS中数据的问题
如图```
       我想在输入完了学号后```在其他的text  和 combo中能显示出数据库中相应的信息``
       但是输入后```界面上什么都不显示- -``请教高手解答``谢谢了``
Dim x, r As String
Dim SQL As String
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
On Error GoTo 20
Adodc1.RecordSource = "select * from 信息表"
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
  MsgBox ("记录为空,请退出!")
  Exit Sub
End If
x = InputBox("请输入学号,10位字符!", "提示")
If (x) = "" Then
MsgBox ("请选择字段!")
Text1.Text = ""
Exit Sub
End If
If Val(x) >= 1000000000 And Val(x) <= 9999999999# Then
Adodc1.RecordSource = "select * from 信息表 where x like" & "'%" & x & "%'" & " order by XH"
If Not Adodc1.Recordset.EOF Then
Adodc1.Refresh
Text1.Text = Adodc1.Recordset.Fields(0)
Text2.Text = Adodc1.Recordset.Fields(1)
Combo1.Text = Adodc1.Recordset.Fields(2)
Text3.Text = Adodc1.Recordset.Fields(3)
Text4.Text = Adodc1.Recordset.Fields(4)
Text5.Text = Adodc1.Recordset.Fields(5)
Combo2.Text = Adodc1.Recordset.Fields(6)
Text6.Text = Adodc1.Recordset.Fields(7)
Text7.Text = Adodc1.Recordset.Fields(8)
End If

VB.jpg (27.13 KB)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: ACCESS 数据 查询 在线 
2008-11-26 16:08
qwaszwc
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-9-29
收藏
得分:0 
ado控件绑定不如代码的灵活
不如用个循环语句放在显示字段的前面
do
adodc1.recordset.movenext
loop while adodc1.recordset.fields(0)=x

2008-11-26 22:02
快速回复:查询ACCESS中数据的问题
数据加载中...
 
   



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

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