FIX: ???? System.Data ???????? ?? ????? ???? ?? ?? ???? ??? ?? ??? ?????? ?? ?? Microsoft .NET Framework 2.0 ?? ????? ?? ?? ???? ????????? ??? ????? ?? ???? ??

???? ?????? ???? ??????
???? ID: 932491 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?????

?? ?? Microsoft .NET Framework 2.0 ?? ????? ?? ?? ???? ????????? ??? ??? ?? ????? ???? ?? ?????? ????, ??? ?? ??? ?????? ?? ?? ???? ????? ?? ???? ??? ?? ?????? ?? ???? ?? ??? ?? ????? ???? ?? ?? ????System.Data.DataSet???????? ??? ?? ?? ?????? ?? ???? ??, ???? ????? ???????? ??? ?? ?? ?? ???? ?? ???? ???:
  • ??AcceptChanges?????? ?? ??? ??DataView???? ?? ??? ???? ???? ??, ??????? ??????? ????? ?? ???? ???
  • ???? ?????? ????? ??? ??? computed ??? ??? ?? ?????? ???? ???? ?? ???? ???
  • ??DataTable.Select?????? ??? ?? ????? ?? ?????? ?? ??? ???? ???? ??, ?? ??? ?????? ???? ?? ?????
  • ??????????? ?? ?????? ??DataTable???????? ????? ?? ???? ??? ??? ??, ?? ???? '13' ?????? ????? ??????? ???? ???
  • ?? ??? ???? ???????? ???? ??, ??????? ??????? ?? ???? ?? ????? ??? ?????? ?????? ?????? ?? ?????? ??? ???
  • ??????????? ?? ?????? ??DataTable???????? ????? ?? ???? ??? ??? ??, ?? ???? '5' ?????? ????? ??????? ???? ???

????????

???????? ???????



?? ??????? ????????? Microsoft ?? ?????? ??.. ???????, ?? ????????? ???? ?? ?????? ??? ???? ?? ??? ?????? ?? ???? ?? ???? ??? ?????? ???? ??? ??.. ?? ????????? ???? ?? ???????? ?? ???? ???? ?? ?? ??????? ?????? ?? ?????? ?? ??? ???.. ?? ????????? ???? ???????? ??????? ??????? ???.. ?????, ??? ?? ?? ?????? ?? ????? ??? ?? ???????? ???? ???, ?? ?? ??????? ???? ??? ?? ?? ?? ????????? ???? ???? ?????????? ?????? ?? ??? ????????? ????..

MSDN ??? ????? ?? ?? ????????? ??????? ???? ?? ???, ????? Microsoft ??? ???? ?? ????::
HTTP://code.MSDN.Microsoft.com/KB932491

???:MSDN ??? ????? ?????? ?? ?????? ???????? ?????? ?? ?? ????????? ???? ??? ??? ?? ???? ???? ???????? ???? ????? ???, ?? ??? ????? ???? ?? ??????? ?? ???? ?? ??? ??? ????? ?????? ????? ?????? ???? ??..

???:??? ???????? ???????? ??????? ???? ?? ?? ??? ??? ?? ?????? ?????? ??, ?? ???? ?? ??? ???? ?????? ????? ?? ??? ?? ?? ???? ??? ???????? ?????? ???????? ?? ?? ???????? ?? ??? ?? ?????? ????? ???? ???? ?? ?? ??????? ????????? ?? ??? ????? ???? ???.. Microsoft ?????? ???? ?? ?????? ???????? ?????? ?? ?? ????? ???? ?? ??? ?? ?? ??? ???? ?????? ????? ?? ???, ????? Microsoft ??? ???? ?? ????::
http://support.microsoft.com/contactus/?ws=support

??????????????

???? ?? ??? ???? ?? ?? ???????? ?? ??????? ???? ?? ??? ????

???? ??????? ????????

?? ???????? ?? ???? ???? ?? ??? ???? ???????? ?? ???????? ???? ?? ???????? ???? ??..

????????? ???????????? ???????

?? ???????? ???? ?? ???????? ?? ???????????? ???? ????..

????? ???????

?? ????????? ?? ????????? ??????? ??? ?? ????? ????????? (?? ??? ?? ????? ?????????) ??? ?? ????? ?????? ??? ???????? ???.. ?? ??????? ?? ??? ?????? ?? ???, ??????? ????????? ??? (UTC) ??? ???????? ??.. ?? ?? ????? ??????? ????? ???, ?? ?? ??????? ??? ??? ?????? ???? ???? ??.. "UTC ?? ??????? ??? ??? ???? ????? ?? ???, ???????? ??? ??? ""?????? ?? ??? ???"" ??? """"??? ???????"" "??? ????????? ?? ??????????? ???? ??? ???? ???
x86-?????? ?????????? ?? ???:
?? ?????? ?? ??????? ?????? ?????? ?? ??????? ????
????? ???????? ?? ???????????? ?????????????:??????????
Mscordacwks.dll2.0.50727.802802,30403-Feb-200711: 22x86
Mscorjit.dll2.0.50727.802326,65603-Feb-200711: 22x86
Mscorlib.dll2.0.50727.8024,308,99203-Feb-200711: 22x86
Mscorpe.dll2.0.50727.802102,91203-Feb-200711: 22x86
Mscorwks.dll2.0.50727.8025,625,34403-Feb-200711: 21x86
Normalization.dll2.0.50727.80215,36003-Feb-200711: 22x86
Normidna.nlp???? ????59,34203-Feb-200711: 22???? ????
Normnfc.nlp???? ????45,79403-Feb-200711: 22???? ????
Normnfd.nlp???? ????39,28403-Feb-200711: 22???? ????
Normnfkc.nlp???? ????66,38403-Feb-200711: 22???? ????
Normnfkd.nlp???? ????60,29403-Feb-200711: 22???? ????
Peverify.dll2.0.50727.802136,19203-Feb-200711: 21x86
Sos.dll2.0.50727.802382,46403-Feb-200711: 22x86
System.DATA.dll2.0.50727.8022,902,01603-Feb-200711: 22x86
System.DATA.oracleclient.dll2.0.50727.802482,30403-Feb-200711: 22x86
Vsavb7rt.dll8.0.50727.8021,330,68803-Feb-200711: 21x86
x64-?????? ?????????? ?? ???:
?? ?????? ?? ??????? ?????? ?????? ?? ??????? ????
????? ???????? ?? ???????????? ?????????????:??????????
Mscordacwks.dll2.0.50727.8021,597,44003-Feb-200703: 14x64
Mscordacwks.dll2.0.50727.802802,30403-Feb-200711: 22x86
Mscorjit.dll2.0.50727.8021,587,71203-Feb-200703: 13x64
Mscorjit.dll2.0.50727.802326,65603-Feb-200711: 22x86
Mscorlib.dll2.0.50727.8023,960,83203-Feb-200706: 28x64
Mscorlib.dll2.0.50727.8024,308,99203-Feb-200711: 22x86
Mscorpe.dll2.0.50727.802157,18403-Feb-200703: 07x64
Mscorpe.dll2.0.50727.802102,91203-Feb-200711: 22x86
Mscorpjt.dll2.0.50727.8022,004,99203-Feb-200703: 13x64
Normalization.dll2.0.50727.80218,43203-Feb-200703: 12x64
Normalization.dll2.0.50727.80215,36003-Feb-200711: 22x86
Normidna.nlp???? ????59,34203-Feb-200703: 14???? ????
Normidna.nlp???? ????59,34203-Feb-200711: 22???? ????
Normnfc.nlp???? ????45,79403-Feb-200703: 14???? ????
Normnfc.nlp???? ????45,79403-Feb-200711: 22???? ????
Normnfd.nlp???? ????39,28403-Feb-200703: 14???? ????
Normnfd.nlp???? ????39,28403-Feb-200711: 22???? ????
Normnfkc.nlp???? ????66,38403-Feb-200703: 14???? ????
Normnfkc.nlp???? ????66,38403-Feb-200711: 22???? ????
Normnfkd.nlp???? ????60,29403-Feb-200703: 14???? ????
Normnfkd.nlp???? ????60,29403-Feb-200711: 22???? ????
Peverify.dll2.0.50727.802136,19203-Feb-200711: 21x86
Peverify.nlp2.0.50727.802205,82403-Feb-200703: 13???? ????
Sos.dll2.0.50727.802480,76803-Feb-200703: 22x64
Sos.dll2.0.50727.802382,46403-Feb-200711: 22x86
System.DATA.dll2.0.50727.8022,967,04003-Feb-200706: 28x64
System.DATA.dll2.0.50727.8022,902,01603-Feb-200711: 22x86
System.DATA.oracleclient.dll2.0.50727.802498,68803-Feb-200706: 28x64
System.DATA.oracleclient.dll2.0.50727.802482,30403-Feb-200711: 22x86
Mscorwks.dll2.0.50727.80210,323,45603-Feb-200703: 11x64
Mscorwks.dll2.0.50727.8025,625,34403-Feb-200711: 21x86
Vsavb7rt.dll8.0.50727.8021,330,68803-Feb-200711: 21x86
???????-?????? ?????????? ?? ???
?? ?????? ?? ??????? ?????? ?????? ?? ??????? ????
????? ???????? ?? ???????????? ?????????????:??????????
Mscordacwks.dll2.0.50727.8022,719,23203-Feb-200703: 15IA-64
Mscordacwks.dll2.0.50727.802802,30403-Feb-200711: 22x86
Mscorjit.dll2.0.50727.8022,705,92003-Feb-200703: 13IA-64
Mscorjit.dll2.0.50727.802326,65603-Feb-200711: 22x86
Mscorlib.dll2.0.50727.8023,960,83203-Feb-200706: 42IA-64
Mscorlib.dll2.0.50727.8024,308,99203-Feb-200711: 22x86
Mscorpe.dll2.0.50727.802313,85603-Feb-200703: 06IA-64
Mscorpe.dll2.0.50727.802102,91203-Feb-200711: 22x86
Mscorpjt.dll2.0.50727.8023,501,05603-Feb-200703: 14IA-64
Normalization.dll2.0.50727.80215,36003-Feb-200711: 22x86
Normalization.dll2.0.50727.80244,03203-Feb-200703: 12IA-64
Fl_normidna.nlp???? ????59,34203-Feb-200711: 22???? ????
Normidna.nlp???? ????59,34203-Feb-200703: 14???? ????
Normnfc.nlp???? ????45,79403-Feb-200711: 22???? ????
Normnfc.nlp???? ????45,79403-Feb-200703: 14???? ????
Normnfd.nlp???? ????39,28403-Feb-200711: 22???? ????
Normnfd.nlp???? ????39,28403-Feb-200703: 14???? ????
Normnfkc.nlp???? ????66,38403-Feb-200711: 22???? ????
Normnfkc.nlp???? ????66,38403-Feb-200703: 14???? ????
Normnfkd.nlp???? ????60,29403-Feb-200711: 22???? ????
Normnfkd.nlp???? ????60,29403-Feb-200703: 14???? ????
Peverify.dll2.0.50727.802136,19203-Feb-200711: 21x86
Peverify.dll2.0.50727.802383,48803-Feb-200703: 13IA-64
Sos.dll2.0.50727.802382,46403-Feb-200711: 22x86
Sos.dll2.0.50727.802862,72003-Feb-200703: 23IA-64
System.DATA.dll2.0.50727.8022,902,01603-Feb-200711: 22x86
System.DATA.dll2.0.50727.8023,109,88803-Feb-200706: 42IA-64
System.DATA.oracleclient.dll2.0.50727.802482,30403-Feb-200711: 22x86
System.DATA.oracleclient.dll2.0.50727.802501,76003-Feb-200706: 42IA-64
Mscorwks.dll2.0.50727.8025,625,34403-Feb-200711: 21x86
Mscorwks.dll2.0.50727.80221,309,95203-Feb-200703: 11IA-64
Vsavb7rt.dll8.0.50727.8021,330,68803-Feb-200711: 21x86

??????

Microsoft ?? ?????? ?? ?? ?? ?? ?? Microsoft ???????? ??? ?? ?????? ?? ?? "???? ???? ???? ???" ?????? ???????? ???..

???? ???????

?????? 1: ???? DataView ???? ??? AcceptChanges ?????? ?? ??? ???? ???? ??, ?? ??????? ??????? ?? ???? ?? ????? ??

??? ????? ?????? ?? ?? ???? ???????? ?? ????? ??????? ??????? ????? ?? ???? ??? ?? ??? ???? ??, ?? System.NullreferenceException ????? ????? ?? ???? ??? ???? ???? ??? ??, ?? ????????? ?? ?? ???? ???????? ??? ??ListChanged?????, ??????????? ?????? ???? ???? ??? ?? ?????

?????? ?? ???, ?? ???????? ?? ????? ????::
  1. ????????? ??? ???? ????? ??? ?? ????? ????:
    using System;
    using System.ComponentModel;
    using System.Data;
    
    class Test {
        private static DataRow _dr = null;
        private static bool _accept = false;
        
        public static void Main()
        {
            try {
                DataSet ds = new DataSet();
                DataTable dt = ds.Tables.Add("Customers");
                DataColumn c = dt.Columns.Add("Id", typeof(int));
                dt.PrimaryKey = new DataColumn[] { c };
                dt.Columns.Add("Name", typeof(string));
                dt.Columns.Add("Age", typeof(int));
                
                dt.Rows.Add(new object[] { 1, "A", 10 });
                dt.Rows.Add(new object[] { 2, "B", 20 });
                dt.Rows.Add(new object[] { 3, "G", 30 });
                dt.Rows.Add(new object[] { 4, "H", 40 });
                dt.Rows.Add(new object[] { 5, "I", 50 });
    
                ds.AcceptChanges();
                            
                DataView dv = new DataView(dt);
                dv.Sort = "Name ASC";
                                        
                dv.ListChanged += new ListChangedEventHandler(OnListChanged);
                            
                _dr = dt.Rows[4];
                
                _accept = true;
                _dr["Name"] = "C";
                _accept = false;
                            
                _dr["Name"] = "D";
                _dr["Age"] = 55;            
                            
                Console.WriteLine(dv[2][1]);                        
            } catch (Exception exc) {
                Console.WriteLine(exc);
            }
        }
        
        public static void OnListChanged(object sender, ListChangedEventArgs args)
        {
            if (_dr != null && _accept) {
                _dr.AcceptChanges();
            }
        }
    }
  2. ????????? ??????
?? ???????? ???, ???? ????? ?????? ????? ?? ???? ?? ?????? ????? ??????? ???? ??:
System.NullReferenceException: ???????? ?????? ???????? ?? ??????? ?? ??? ??? ????? ?? c:\Work\bugs\newbug1\Test.cs:line 42 ??? Test.Main() ?? System.Data.DataRowView.get_Item (Int32 ndx) ?? System.Data.DataView.IsOriginalVersion (Int32 ???????????)
?? ?????? ?? ?? ???? ?? ??? ???? ???? ??? ??? ???? ???????? ????ListChanged?????? ?? ????? ???? ?? ??? ??????? ??RowChanged?? ????? ?? ?????ListChanged??????

?????? 2: ???? ?????? ????? ??? computed ??? ?? ???? ?? ?????? ???? ?? ?? ??? ??? ??

?? ?? ???? ?????? ????? ?? ??? ?? compute ?????? ??DataSet???????? ?? ?????????? ????? ??? ??? ????? ??, ?? ?????????? ?? ????? computed ??? ?? ???? ?? ?????? ???? ?? ?? ??? ??? ?????? ?? ???, ?? ???????? ?? ????? ????::
  1. ????????? ??? ???? ????? ??? ?? ????? ????:
    using System;
    using System.ComponentModel;
    using System.Data;
    
    class Test {
        public static void Main()
        {
            try {
                DataSet ds = new DataSet();
    
                DataTable dt1 = ds.Tables.Add("T1");
                dt1.Columns.Add("CustId", typeof(int));
                dt1.Columns.Add("CustName", typeof(string));
    
                DataTable dt2 = ds.Tables.Add("T2");
                dt2.Columns.Add("EmpId", typeof(int));
                DataColumn dcEmpName = dt2.Columns.Add("EmpName", typeof(string));
                DataColumn dcMgrName = dt2.Columns.Add("MgrName", typeof(string));
                DataColumn dcReports = dt2.Columns.Add("NumberOfReports", typeof(int));
                
                DataRelation rel1 = ds.Relations.Add("T1T2", dt1.Columns["CustId"], dt2.Columns["EmpId"], false);
                DataRelation rel2 = ds.Relations.Add("T2T2", dt2.Columns["EmpName"], dt2.Columns["MgrName"], false);
    
                dcEmpName.Expression = "Parent(T1T2).CustName";
                dcMgrName.Expression = "Parent(T1T2).CustName"; 
    
                //Each person is a manager to himself.
                dcReports.Expression = "Count(Child(T2T2).EmpName)"; 
    
                AddRow(dt1, 1, "N1");
                AddRow(dt1, 2, "N2");
                AddRow(dt1, 3, "N3");
    
                AddRow(dt2, 1);
                AddRow(dt2, 2);
                AddRow(dt2, 3);
    
                Console.WriteLine(ds.GetXml());
    
                dt1.Rows[0]["CustName"] = "N4";
    
                Console.WriteLine(ds.GetXml());
            } catch (Exception exc) {
                Console.WriteLine(exc);
            }
        }
    
        public static void AddRow(DataTable dt, params object[] objArr)
        {
            Console.WriteLine("Adding row to table {0}", dt.TableName);
            dt.Rows.Add(objArr);
        }
    }
  2. ????????? ??????
?? ???????? ???, ?? ????? ?????? ??????? ???? ??:
<NewDataSet>
 <T1>
   <CustId>1</CustId>
   <CustName>N4</CustName>
 </T1>
 <T1>
   <CustId>2</CustId>
   <CustName>N2</CustName>
 </T1>
 <T1>
   <CustId>3</CustId>
   <CustName>N3</CustName>
 </T1>
 <T2>
   <EmpId>1</EmpId>
   <EmpName>N4</EmpName>
   <MgrName>N4</MgrName>
   <NumberOfReports>0</NumberOfReports> 
 </T2>
 <T2>
   <EmpId>2</EmpId>
   <EmpName>N2</EmpName>
   <MgrName>N2</MgrName>
   <NumberOfReports>1</NumberOfReports>
 </T2>
 <T2>
   <EmpId>3</EmpId>
   <EmpName>N3</EmpName>
   <MgrName>N3</MgrName>
   <NumberOfReports>1</NumberOfReports>
 </T2>
</NewDataSet>
?? ?????? ???NumberOfReports???? T2 ???? ??? ???? ??? ??? ??? ?? 1 ?? ???? 0 ???

?????? 3: ?????? ??? ?? ????? ???? DataTable.Select ?????? ?? ??? ???? ???? ??, ?? ??? ??? ?????? ???? ?? ???? ??

?? ?? ????? ??????? ?????? ?????? ??DataTable?????? ??? ?? ??? ???? ??????? ???? ?? ??? AND ??? ?? ??? ??????????? ?????????? ?? ??? ?????? ???? ??? ?? ???? ??? ?????? ?? ???, ????? ??? ???? ???? ??? ??????:
string filter = "(NOT ColTwo = 1) AND (ColOne = 2)";
DataTable.Select(filter);
???????, ????? ??? ???? ??? ??????:
string filter = "NOT ColTwo = 1 AND ColOne = 2";
DataTable.Select(filter);
??? ??, ???????? ?? ????? ????:
  1. ????????? ??? ???? ????? ??? ?? ????? ????:
    public static void Main()
    {
      DataTable table = new DataTable();
      table.Columns.Add("ColID", typeof(int));
      table.Columns.Add("ColOne", typeof(int));
      table.Columns.Add("ColTwo", typeof(int));
      table.Rows.Add(new object[] { 1, 1, 1 });
      table.Rows.Add(new object[] { 2, 1, 2 });
      table.Rows.Add(new object[] { 3, 2, 1 });
      table.Rows.Add(new object[] { 4, 2, 2 });
    
      string[] queries = new string[] {
          "(NOT ColTwo = 1) AND (ColOne = 2)",
          "(ColOne = 2) AND (NOT ColTwo = 1)",
    
          "NOT ColTwo = 1 AND ColOne = 2",
          "ColOne = 2 AND NOT ColTwo = 1",
    
          "NOT ColTwo = 1 AND (ColOne = 2)",
          "(ColOne = 2) AND NOT ColTwo = 1",
    
          "(NOT ColTwo = 1) AND ColOne = 2",
          "ColOne = 2 AND (NOT ColTwo = 1)",
      };
    
      Console.WriteLine("Select");
      foreach(string query in queries) {
          DataRow[] rows = table.Select(query);
          Console.WriteLine("query=\"{0}\" count={1}", query, rows.Length);
          foreach(DataRow row in rows) {
              Console.WriteLine("\t{0}, {1}, {2}", row[0], row[1], row[2]);
          }
      }
    }
    
  2. You run the application.
In this scenario, you receive the following output:
query="(NOT ColTwo = 1) AND (ColOne = 2)" count=2
        3, 2, 1
        4, 2, 2
query="(ColOne = 2) AND (NOT ColTwo = 1)" count=1
        4, 2, 2
query="NOT ColTwo = 1 AND ColOne = 2" count=1
        4, 2, 2
query="ColOne = 2 AND NOT ColTwo = 1" count=1
        4, 2, 2
query="NOT ColTwo = 1 AND (ColOne = 2)" count=2
        3, 2, 1
        4, 2, 2
query="(ColOne = 2) AND NOT ColTwo = 1" count=1
        4, 2, 2
query="(NOT ColTwo = 1) AND ColOne = 2" count=1
        4, 2, 2
query="ColOne = 2 AND (NOT ColTwo = 1)" count=1
        4, 2, 2
In this output, "(ColOne = 2)" is incorrectly displayed on the right side of an AND clause.

Issue 4: The internal index of a DataTable may become corrupted, and you receive a '13' error message

?? ?? ?? ????? ???? ???AcceptChanges?? ?????? ??DataSetobject that is used by theDataTableobject, and you set a ForeignKey rule toAcceptRule.Cascade, the internal index values that are used by theDataSet???????? ????? ?? ???? ??? ?? ?????? ????? ????????? ?? ???? ???? ?? ???? ??::
  • TheDataSetobject contains one or more tables that have one-to-many relationships.
  • TheAcceptChanges?? ??? ????DataSetobject is called.
  • TheAcceptRejectRule?? ???DataSetobject is set to Cascade. When this value is set to Cascade, the child table is changed so that it automatically either accepts data or rejects data.
?????? ?? ???, ?? ???????? ?? ????? ????::
  1. ????????? ??? ???? ????? ??? ?? ????? ????:
    public void Main()
    {
    			DataTable Table = new DataTable("Employee");
    			Table.Columns.Add("Id", typeof(int));
    			Table.Columns.Add("ManagerId", typeof(int));
    			Table.Columns.Add("Name", typeof(string));
    
    			Table.Columns["Name"].AllowDBNull = false;
    			Table.PrimaryKey = new DataColumn[] {Table.Columns["Id"]};
    
    			DataSet Employees = new DataSet();
    			Employees.Tables.Add(Table);
    
    			DataRelation rel = Employees.Relations.Add(Table.Columns["ID"], Table.Columns["ManagerId"]);
    			rel.ChildKeyConstraint.AcceptRejectRule = AcceptRejectRule.Cascade;
    
    			DataRow ManagerA = Table.NewRow();
    			ManagerA["ID"] = 2019;
    			ManagerA["Name"] = "Manager A";
    			Table.Rows.Add(ManagerA);
    
    			DataRow ManagerB = Table.NewRow();
    			ManagerB["ID"] = 392;
    			ManagerB["Name"] = "Manager B";
    			Table.Rows.Add(ManagerB);
    
    			DataRow EmployeeB = Table.NewRow();
    			EmployeeB["ID"] = 716;
    			EmployeeB["Name"] = "Employee of B";
    			EmployeeB.SetParentRow(ManagerB);
    			Table.Rows.Add(EmployeeB);
    
    			EmployeeB = Table.NewRow();
    			EmployeeB["ID"] = 637;
    			EmployeeB["Name"] = "2nd employee of B";
    			EmployeeB.SetParentRow(ManagerB);
    			Table.Rows.Add(EmployeeB);
    
    			Employees.AcceptChanges();
    			Table.Rows.Find(392).Delete();
    			Employees.AcceptChanges();
    }
  2. ????????? ??????
?? ???????? ???, ???? ????? ?????? ????? ??????? ???? ??:
DataTable internal index is corrupted: '13'.

Issue 5: When a Merge operation occurs, the record manager may become corrupted if the target row is in the edit state

If one or more rows in aDataTableobject are being edited, and then aDataTable.Mergeoperation occurs or aDataSet.Mergeoperation occurs, the record manager for theDataSetobject of theDataTable???????? ????? ?? ???? ???

???:When a row in aDataTableobject is being edited, theDataRowVersionvalue of the row is set to Proposed.

?????? ?? ???, ?? ???????? ?? ????? ????::
  1. ????????? ??? ???? ????? ??? ?? ????? ????:
    using System;
    using System.Data;
    using System.Collections.Generic;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                DataSet set = new DataSet();
                DataTable table = set.Tables.Add("table");
                table.Columns.Add("C1", typeof(int));
                table.Columns.Add("C2", typeof(char));
                table.PrimaryKey = new DataColumn[] { table.Columns[0] };
                for (int i = 0; i < 26; ++i)
                {
                    table.Rows.Add(new object[] { i, (char)((ushort)'a' + i) });
                }
                table.AcceptChanges();
    
                DataSet clone = set.Copy();
                clone.Tables[0].Rows[0][1] = 'Z';
                //clone.AcceptChanges();
    
                table.Rows[0][1] = '1';
                table.Rows[0].BeginEdit();
                table.Rows[0][1] = '2';
    
    
                try
                {
                    set.Merge(clone);
                }
                finally
                {
                   foreach (DataRow row in table.Rows) {
    																	Console.WriteLine("{0}={1}", row[0], row[1]);
    															}
                }
    
            }
        }
    }
  2. ????????? ??????
In this scenario, the record manager for theDataSetobject of theDataTableobject is corrupted.

To work around this problem, make sure that there are no rows in the destinationDataSetobject that have theDataRowVersionvalue set to Proposed before you use theDataTable.Merge?????? ??DataSet.Merge?????? ???

Issue 6: The internal index of a DataTable object may become corrupted, and you receive a '5' error message

The following scenarios cause corruption in aDataTableobject by changing the data in theDataTableobject without updating the internal indexes of theDataTable????????:
  1. TheDataColumn.Expression??? ?????????? ?? ??? ???? ?????? ?? ??? ??? ??? ??? ?? ???????? ???, ??? ??? ????DataColumn???????? DBNull ???? ?? ??? ??? ???
  2. ??DataTable.clear???? ?????? ??, ??? ????DataTable???????? ?? ????? ???? ??? ?? ?? ??????????? ?? ?????? ????? ??? ??, ???? ?? ?????? ????????DataTable???????? ?? ?????? ???? ????
?????? ?? ???, ?? ???????? ?? ????? ????::
  1. ????????? ??? ???? ????? ??? ?? ????? ????:
    using System;
    using System.Data;
    using System.Collections.Generic;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                DataSet set = new DataSet("s");
                DataTable table1 = set.Tables.Add("a");
                table1.Columns.Add("C1", typeof(int));
                table1.Columns.Add("C2", typeof(int));
                table1.DefaultView.Sort = "C2";
    
                DataTable table2 = set.Tables.Add("b");
                table2.Columns.Add("C1", typeof(int));
                table2.Columns.Add("C2", typeof(int));
                table2.DefaultView.Sort = "C2";
    
                set.Relations.Add(new DataRelation("t1t2", table1.Columns[0], table2.Columns[0], false));
                table1.Columns[1].Expression = "Sum(Child(t1t2).C2)";
    
                AddData(table1, 1);
                AddData(table2, 2);
    
                table1.Columns[1].Expression = null;
    
                AddData(table2, 2);
                AddData(table1, 2);
    
            }
            private static void AddData(DataTable table, int y)
            {
                object[] x = new object[y];
                Random rand = new Random(20070125);
                for (int i = 0; i < 1000; ++i)
                {
                    switch (rand.Next(3))
                    {
                        case 0:
                        case 1:
                            for (int k = 0; k < x.Length; ++k)
                            {
                                x[k] = rand.Next(500);
                            }
                            table.Rows.Add(x);
                            break;
                        case 2:
                            if (0 < table.Rows.Count)
                            {
                                table.Rows.RemoveAt(rand.Next(table.Rows.Count));
                            }
                            break;
                    }
                }
            }
    
        }
    }
    
    
  2. ????????? ??????
?? ???????? ???, ???? ????? ?????? ????? ??????? ???? ??:
DataTable ?????? ??????????? ????? ??: '5'?
???? ??????? ?? ???, Microsoft ?????? ??? ??? ???? ????? ?? ??? ????? ???? ?????? ????? ????::
824684Microsoft ?????????? ???????? ?? ????? ???? ?? ??? ????? ?? ???? ???? ???? ???????? ?? ?????
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

???

???? ID: 932491 - ????? ???????: 06 ?????? 2010 - ??????: 6.0
???? ???? ???? ??:
  • Microsoft .NET Framework 2.0
??????: 
kbfix kbbug kbprb kbexpertiseinter kbexpertisebeginner kbqfe kbmt KB932491 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:932491

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com