datagrid更新编辑数据
sub datagrid_updatecommand(sender as object,e as datagridcommandeventargs)
dim content as string=ctype(e.item.cells(1).controls(0),textbox).text
dim username as string=ctype(e.item.cells(2).controls(0),textbox).text
dim times as string=mid(now(),1,20)
dim strsql as string
strsql="update content set content=" & content & ",shbuser=" & username & ",shbdate="& times &" where "& mydatagrid.datakeyfield &"="& mydatagrid.datakeys(e.item.itemindex)
dim objconn as new oledbconnection()
objconn.connectionstring="provider=microsoft.jet.oledb.4.0; data source=" & server.mappath("./data.mdb")
objconn.open()
dim objcmd as new oledbcommand(strsql,objconn)
objcmd.executenonquery
mydatagrid.edititemindex=-1
bindlist()
更改数据后再重新绑定了为什么不能及时刷新datagrid中显示的数据啊????有什么办法让他更新后马上就能显示新数据吗????
你确认数据添加进去了?或者bandlist()函数没有问题?
Are you Sure that you have updated the DataOjbect?
参考http://www.cnblogs.com/suibing/archive/2005/04/05/132650.html
自己单步调试一下,看给取到数据了?