1. if there is not much data, save your DataTable or DataSet in a Session variable, when you are ready to update the database, use a DataAdapter, call its Update method on the DataTable2. consider to reinstall IIS, don't forget to run
aspnet_regiis -i

解决方案 »

  1.   

    你可以这样解决:
    首先,新建一个虚拟目录(例如:myweb),该虚拟目录指向你的文件夹。
    然后,找到一个.csproj.webinfo文件,用记事本打开,你会看到类似下面的代码:
    <VisualStudioUNCWeb>
        <Web URLPath = "http://192.168.1.4/webapp/webapp.csproj" />
    </VisualStudioUNCWeb>
    修改其中的192.168.1.4为你的IP,修改“webapp”为“myweb”(注:webapp.csproj不要修改),然后保存文件。
    然后,双击.csproj文件,VS.NET打开项目.
      

  2.   

    楼上说的,我已经试过了。思归大哥,我的datagrid不是从数据库中取数据绑定的,而是采用模板列,全部是textbox, 我要把其中的数据提交到数据库中去,不知采用您的方法是否可以,请详细说明行吗?
      

  3.   


    when you update, DataTable dt;if (Session["MyTable"] == null)
    {
      dt = new DataTable();
      dt.Columns.Add("col1", typeof(string));
      dt.Columns.Add("col2", typeof(string));  Session["MyTable"]  = dt;
    }dt = (DataTable)Session["MyTable"];
    //add new data hereDataRow dr = dt.NewRow();
    dr["col1"] = ....;
    dr["col2"] = ....;
    dt.Rows.Add(dr);
    ...when you want to update,SqlDataAdapter da = new SqlDataAdapter("select * from yourtable where 1=2", connString);
    SqlCommandBuilder cb = new SqlCommandBuilder(da); //assume yourtable has a primary key)
    DataTable dt = (DataTable)Session["MyTable"];
    da.Update(dt);
    dt.AcceptChanges();