dadagrid用updatet和databind(),后台数据库内容已经更新了,但页面还没有更新。如何处理。

解决方案 »

  1.   

    不行呀。
    我用的是access2000sub bindlist()
        dim strsql as string="select * from dept order by dept.userno asc"
    dim objdataadapter as new oledbDataAdapter(strsql,myconn)
    Dim DS As New DataSet()
    objdataadapter.Fill(DS, "dept")
        datagrid1.datasource=ds.tables("dept").DefaultView
    datagrid1.databind()
    end subSub Page_Load(Src As Object, E As EventArgs)    myconn=new oledbconnection("provider=microsoft.jet.oledb.4.0;data source="&server.mappath(ConfigurationSettings.appSettings("数据库")))
        if not ispostback then bindlist()
    End Subub datagrid_updatecommand(sender as object,e as datagridcommandeventargs)
         mypanel.visible=false
         dim userdept as string=ctype(e.item.cells(0).controls(0),textbox).text
     dim userno as string=ctype(e.item.cells(1).controls(0),textbox).text
     dim strsql as string
     strsql="select * from dept where dept='"& userdept &"'"
     dim objconn as new oledbconnection()
     objconn.connectionstring="provider=microsoft.jet.oledb.4.0;data source="&server.mappath(ConfigurationSettings.appSettings("数据库"))
     objconn.open
     dim objcmd as new oledbcommand(strsql,objconn)
     dim objreader as oledbdatareader=objcmd.executereader()
         dim updatestr as string
     updatestr="update dept set dept=?,userno=?  where id=?"
    .......        datagrid1.edititemindex=-1
            bindlist()
      

  2.   

    我查了本书,说acess数据库会有这种问题,sql没有。是这样的吗。
      

  3.   

    原来的程序中我用了response.redirect也不行。
      

  4.   

    是这样的,access不支持自动更新,你重新调用一次数据绑定
      

  5.   

    我重新bindlist()
    但没有效。
    tophifi(黑字先生) 可以给些代码吗。
      

  6.   

    把虚拟目录加上写的权限。
    不行的话再把程序目录加上USER完全控制权限