帮忙看一下怎么改啊!

来源:百度知道 编辑:UC知道 时间:2024/05/18 00:03:34
我做了一个浏览用户的窗体,用了一个Adodc控件和一个datagrid控件,一个返回按钮,datagrid的datasource属性为adodc1,adodc1的connectstring属性为Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="DSN=db1;DBQ=E:\yu\biyesheji\1\db1.mdb;DriverId=25;FIL=MSAccess;MaxBufferSize=2048;PageTimeout=5;UID=admin;"代码为
Private Sub Command1_Click()
Adodc1.RecordSource = "select * from 用户资料 order by 用户名"
Unload Me
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;Persist Security Info=False"
End Sub运行的时候提示:〔ADODC〕没有指定记录源。[ADO]没有为命令对象设置命令。请帮忙看一下怎么改!谢谢!

Private Sub Command1_Click()
Adodc1.RecordSource = "select * from 用户资料 order by 用户名"
Adodc1.Refresh

End Sub

Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from 用户资料" '这步不要忘了.
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub