楼上说的是我笔误!
我的意思是在web ,对数据修改后,通过dataset Update
放在不同的方法中提示 Object reference 错误
Dataset 使用 Session 装载后,SqlDataAdapter 还是 Object reference 错误
SqlDataAdapter 重新 new() 后(感觉不对),调用 update 方法后,数据未更改
请高手指教!

解决方案 »

  1.   

    你的da是否全局静态变量?
    DataSet使用Session装载是没用的,只是一个数据集,你把da用session装载试试,或者把它设为静态变量。
      

  2.   

    一直使使用全局变量的,不过web情况下,变量不能持续存在希望达到的目的是:
    使Dataset绑定的控件textbox 经用户在web条件下修改后
    直接使用 update 方法将数据改变传回数据库
      

  3.   

    你不会用sql语句重先执行一下吗?
    使用sql = "update set..."
    然后, sqlcmd = new SqlCommand(sql, myconnection)
    myconnection.open()
    sqlcmd.ExecuteNonQuery()
    myconnection.close()
      

  4.   

    Initialize DS:
    DS = new DataSet();
    //DS = get some data
    Session["DS"] = DS;you can use DS in another method like this:
    DS = (DataSet)Session["DS"];
    //Add, modify, delete from DS ...