日期:2014-05-18  浏览次数:20526 次

求达人帮忙看一下,Original为什么取不到值,我已经把那一句注释了
<%@   Import   NameSpace=System.Data   %>
<%@   Import   NameSpace=System.Data.Common   %>
<%@   page   language= "cs "   runat=server     debug=true   %>
<html>
<head>
<script   runat=server>

void   Page_Load(Object   Sender,EventArgs   e)
{
DataTable   objTable=new   DataTable( "NewTable ");

objTable.Columns.Add( "ISBN ",System.Type.GetType

( "System.String "));
objTable.Columns.Add( "Title ",System.Type.GetType

( "System.String "));
objTable.Columns.Add( "PublicationDate ",System.Type.GetType

( "System.DateTime "));
objTable.Columns.Add( "Quantity ",System.Type.GetType

( "System.Int32 "));

DataRow   objDataRow;
objDataRow=objTable.NewRow();
objDataRow[ "ISBN "]= "123456 ";
objDataRow[ "Title "]= "AAAAA ";
objDataRow[ "PublicationDate "]= "2001-06-01 ";
objDataRow[ "Quantity "]=3956;
objTable.Rows.Add(objDataRow);

objDataRow=objTable.NewRow();
objDataRow[ "ISBN "]= "123232 ";
objDataRow[ "Title "]= "BBBBBB ";
objDataRow[ "PublicationDate "]= "2001-05-11 ";
objDataRow[ "Quantity "]=3433;
objTable.Rows.Add(objDataRow);

objDataRow=objTable.NewRow();
objDataRow[ "ISBN "]= "232432 ";
objDataRow[ "Title "]= "CCCCCC ";
objDataRow[ "PublicationDate "]= "2002-01-21 ";
objDataRow[ "Quantity "]=3256;
objTable.Rows.Add(objDataRow);

DataSet   objDataSet=new   DataSet( "BookDataSet ");
objDataSet.Tables.Add(objTable);

gd1.DataSource=objDataSet.Tables[ "NewTable "].DefaultView;
gd1.DataBind();

DataRow   myRow=objTable.Rows[0];

myRow.BeginEdit();
myRow[ "ISBN "]= "999 ";
gd2.DataSource=objDataSet.Tables[ "NewTable "].DefaultView;
gd2.DataBind();
//label1.Text+=myRow[ "ISBN ",DataRowVersion.Original].ToString();   取不到值
  label2.Text+=myRow[ "ISBN ",DataRowVersion.Proposed].ToString();
label3.Text+=myRow[ "ISBN ",DataRowVersion.Current].ToString();

}
</script>
</head>
<body>
原始表: <br/>
<asp:DataGrid   id=gd1   runat=server/> <p>
更改了第一行的标BeginEdit() <br/>
<asp:DataGrid   id=gd2   runat=server/> <p>
更改后又取消了更改的表CancelEdit() <br/>
<asp:label   id=label1   text= "Original= "   runat=server/> <p>
<asp:label   id=label2   text= "Proposed= "   runat=server/> <p>
<asp:label   id=label3   text= "Current= "   runat=server/> <p>
<asp:DataGrid   id=gd3   runat=server/> <p>
再次进行编辑的标BeginEdit() <br/>
<asp:DataGrid   id=gd4   runat=server/> <p>
编辑后确定的表EndEdit() <br/>
<asp:DataGrid   id=gd5   runat=server/> <p>
</body>
</html>


------解决方案--------------------
沙发,帮忙顶
------解决方案--------------------
//label1.Te