我在:
工程->部件:MIcrosoft DataGrid Control 6.0(OLEDB)
工程->引用:Microsoft ActiveX Data Object 2.1 Library
我在按钮事件里,对DataGrid控件进行ClearFields后,用Rebind命令时,
总是说“不能初始化数据绑定”,这是什么问题啊!
工程->部件:MIcrosoft DataGrid Control 6.0(OLEDB)
工程->引用:Microsoft ActiveX Data Object 2.1 Library
我在按钮事件里,对DataGrid控件进行ClearFields后,用Rebind命令时,
总是说“不能初始化数据绑定”,这是什么问题啊!
sql = "select*from table"
Set rs = ExecuteSQL(sql) **********一个连接数据库的函数
Set DataGrid1.DataSource = rs
With DataGrid1
.Columns(0).Width = 1000
.Columns(1).Width = 1100
.Columns(2).Width = 1000
.Columns(0).Caption = "单位编号"
.Columns(1).Caption = "单位名称"
.Columns(2).Caption = "单位简称"
End With
End Function
这样可以初始化不知道楼主是不是这个意思
XXXconnect.close
再XXXconnect.open
datagrid1.refresh
set datagrid1.datasource=rs'重新载入记录集
datagrid1.refresh
还有:to chenyu5188
你能告诉我为什么ADO对象不能绑定啊,我用了你的方法不能显示数据啊!
datagrid1.refresh
rs.CursorLocation=adUseclient'使用客户端游标
set datagrid1.datasource=rs'重新载入记录集
datagrid1.refresh
我这已经是调试成功的啊对了我用的工程->部件:Microsoft ADO Data Control6.0(SP4)
你不能再DataGrid直接设置column(i)的标题,这样肯定不能显示,我也是这样,不过我摸索了然后高定,DataGrid.column(i) = "用户号",高定了,要给分呀!!!