读书人

vb链接access有关问题

发布时间: 2012-08-13 13:21:53 作者: rapoo

vb链接access问题
1. 使用的是部件adodc和dataGrid,已经实现链接,在datagrid中能出现数据
2. 问题:点击查询按钮,在datagrid中要出现想要的数据
3. 点击按钮代码:

VB code
Private Sub Command4_Click()    Adodc1.RecordSource = "select * from word where id = 2"    Adodc1.Refresh   '此处报错:from字句语法错误,对象refresh的方法IAdodc失败End Sub



[解决办法]
set Adodc1.RecordSource = "select * from word where id = 2"

[解决办法]
探讨
1. 使用的是部件adodc和dataGrid,已经实现链接,在datagrid中能出现数据
2. 问题:点击查询按钮,在datagrid中要出现想要的数据
3. 点击按钮代码:
Private Sub Command4_Click()
Adodc1.RecordSource = "select * from word where id = 2"
Adodc1.Refresh '……

[解决办法]
说明你的表名称有误.
[解决办法]
建议检查下数值类型
[解决办法]
在Adodc1.RecordSource = "select * from word where id = 2" 前加一句
Adodc1.commandType=adcmdtext
试试!

读书人网 >VB

热点推荐