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

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

???????

??? ?????? ??????? ???? ?? ??? ??????? ???? ????? ??? Microsoft .NET Framework 2.0 ???????? ???????? ?? ?????? ?? ????. ???? ??? ??????? ??? ??????? ?????? ???? System.Data.DataSet. ??? ???? ??? ???????? ?? ?????? ???? ?? ???? ?? ???????? ???????:
  • ????? ??? ??????? ????? AcceptChanges ?? ??? DataView ????? ??? ?? ????.
  • ?? ?? ??? ????? ????? ???????? ?? ???? ????? ???? ????.
  • ????? ??? ??????? ????? 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 x
?? ??? ??????????? ??? ??????
??? ?????????? ???????? ????????????????????? ???????
Mscordacwks.dll2.0.50727.802802,304?? ?????? ????11: 22x 86
Mscorjit.dll2.0.50727.802326,656?? ?????? ????11: 22x 86
Mscorlib.dll2.0.50727.8024,308,992?? ?????? ????11: 22x 86
Mscorpe.dll2.0.50727.802102,912?? ?????? ????11: 22x 86
Mscorwks.dll2.0.50727.8025,625,344?? ?????? ????11: 21x 86
Normalization.dll2.0.50727.80215,360?? ?????? ????11: 22x 86
Normidna.nlp??? ???? ???????59,342?? ?????? ????11: 22??? ???? ???????
Normnfc.nlp??? ???? ???????45,794?? ?????? ????11: 22??? ???? ???????
Normnfd.nlp??? ???? ???????39,284?? ?????? ????11: 22??? ???? ???????
Normnfkc.nlp??? ???? ???????66,384?? ?????? ????11: 22??? ???? ???????
Normnfkd.nlp??? ???? ???????60,294?? ?????? ????11: 22??? ???? ???????
Peverify.dll2.0.50727.802136,192?? ?????? ????11: 21x 86
Sos.dll2.0.50727.802382,464?? ?????? ????11: 22x 86
System.data.dll2.0.50727.8022,902,016?? ?????? ????11: 22x 86
System.data.oracleclient.dll2.0.50727.802482,304?? ?????? ????11: 22x 86
Vsavb7rt.dll8.0.50727.8021,330,688?? ?????? ????11: 21x 86
??????? ?????? ????????? ???? ????? ??? 64 x
?? ??? ??????????? ??? ??????
??? ?????????? ???????? ????????????????????? ???????
Mscordacwks.dll2.0.50727.8021,597,440?? ?????? ????03: 14x 64
Mscordacwks.dll2.0.50727.802802,304?? ?????? ????11: 22x 86
Mscorjit.dll2.0.50727.8021,587,712?? ?????? ????03: 13x 64
Mscorjit.dll2.0.50727.802326,656?? ?????? ????11: 22x 86
Mscorlib.dll2.0.50727.8023,960,832?? ?????? ????06: 28x 64
Mscorlib.dll2.0.50727.8024,308,992?? ?????? ????11: 22x 86
Mscorpe.dll2.0.50727.802157,184?? ?????? ??????: ??x 64
Mscorpe.dll2.0.50727.802102,912?? ?????? ????11: 22x 86
Mscorpjt.dll2.0.50727.8022,004,992?? ?????? ????03: 13x 64
Normalization.dll2.0.50727.80218,432?? ?????? ????03: 12x 64
Normalization.dll2.0.50727.80215,360?? ?????? ????11: 22x 86
Normidna.nlp??? ???? ???????59,342?? ?????? ????03: 14??? ???? ???????
Normidna.nlp??? ???? ???????59,342?? ?????? ????11: 22??? ???? ???????
Normnfc.nlp??? ???? ???????45,794?? ?????? ????03: 14??? ???? ???????
Normnfc.nlp??? ???? ???????45,794?? ?????? ????11: 22??? ???? ???????
Normnfd.nlp??? ???? ???????39,284?? ?????? ????03: 14??? ???? ???????
Normnfd.nlp??? ???? ???????39,284?? ?????? ????11: 22??? ???? ???????
Normnfkc.nlp??? ???? ???????66,384?? ?????? ????03: 14??? ???? ???????
Normnfkc.nlp??? ???? ???????66,384?? ?????? ????11: 22??? ???? ???????
Normnfkd.nlp??? ???? ???????60,294?? ?????? ????03: 14??? ???? ???????
Normnfkd.nlp??? ???? ???????60,294?? ?????? ????11: 22??? ???? ???????
Peverify.dll2.0.50727.802136,192?? ?????? ????11: 21x 86
Peverify.nlp2.0.50727.802205,824?? ?????? ????03: 13??? ???? ???????
Sos.dll2.0.50727.802480,768?? ?????? ??????: ??x 64
Sos.dll2.0.50727.802382,464?? ?????? ????11: 22x 86
System.data.dll2.0.50727.8022,967,040?? ?????? ????06: 28x 64
System.data.dll2.0.50727.8022,902,016?? ?????? ????11: 22x 86
System.data.oracleclient.dll2.0.50727.802498,688?? ?????? ????06: 28x 64
System.data.oracleclient.dll2.0.50727.802482,304?? ?????? ????11: 22x 86
Mscorwks.dll2.0.50727.80210,323,456?? ?????? ????03: 11x 64
Mscorwks.dll2.0.50727.8025,625,344?? ?????? ????11: 21x 86
Vsavb7rt.dll8.0.50727.8021,330,688?? ?????? ????11: 21x 86
??????? ?????? ????????? ???????? ??? Itanium
?? ??? ??????????? ??? ??????
??? ?????????? ???????? ????????????????????? ???????
Mscordacwks.dll2.0.50727.8022,719,232?? ?????? ????03: 15IA-64
Mscordacwks.dll2.0.50727.802802,304?? ?????? ????11: 22x 86
Mscorjit.dll2.0.50727.8022,705,920?? ?????? ????03: 13IA-64
Mscorjit.dll2.0.50727.802326,656?? ?????? ????11: 22x 86
Mscorlib.dll2.0.50727.8023,960,832?? ?????? ?????: ??IA-64
Mscorlib.dll2.0.50727.8024,308,992?? ?????? ????11: 22x 86
Mscorpe.dll2.0.50727.802313,856?? ?????? ????03: 06IA-64
Mscorpe.dll2.0.50727.802102,912?? ?????? ????11: 22x 86
Mscorpjt.dll2.0.50727.8023,501,056?? ?????? ????03: 14IA-64
Normalization.dll2.0.50727.80215,360?? ?????? ????11: 22x 86
Normalization.dll2.0.50727.80244,032?? ?????? ????03: 12IA-64
Fl_normidna.nlp??? ???? ???????59,342?? ?????? ????11: 22??? ???? ???????
Normidna.nlp??? ???? ???????59,342?? ?????? ????03: 14??? ???? ???????
Normnfc.nlp??? ???? ???????45,794?? ?????? ????11: 22??? ???? ???????
Normnfc.nlp??? ???? ???????45,794?? ?????? ????03: 14??? ???? ???????
Normnfd.nlp??? ???? ???????39,284?? ?????? ????11: 22??? ???? ???????
Normnfd.nlp??? ???? ???????39,284?? ?????? ????03: 14??? ???? ???????
Normnfkc.nlp??? ???? ???????66,384?? ?????? ????11: 22??? ???? ???????
Normnfkc.nlp??? ???? ???????66,384?? ?????? ????03: 14??? ???? ???????
Normnfkd.nlp??? ???? ???????60,294?? ?????? ????11: 22??? ???? ???????
Normnfkd.nlp??? ???? ???????60,294?? ?????? ????03: 14??? ???? ???????
Peverify.dll2.0.50727.802136,192?? ?????? ????11: 21x 86
Peverify.dll2.0.50727.802383,488?? ?????? ????03: 13IA-64
Sos.dll2.0.50727.802382,464?? ?????? ????11: 22x 86
Sos.dll2.0.50727.802862,720?? ?????? ????03: 23IA-64
System.data.dll2.0.50727.8022,902,016?? ?????? ????11: 22x 86
System.data.dll2.0.50727.8023,109,888?? ?????? ?????: ??IA-64
System.data.oracleclient.dll2.0.50727.802482,304?? ?????? ????11: 22x 86
System.data.oracleclient.dll2.0.50727.802501,760?? ?????? ?????: ??IA-64
Mscorwks.dll2.0.50727.8025,625,344?? ?????? ????11: 21x 86
Mscorwks.dll2.0.50727.80221,309,952?? ?????? ????03: 11IA-64
Vsavb7rt.dll8.0.50727.8021,330,688?? ?????? ????11: 21x 86

?????

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

??????? ????

??????? ??????: ????? ??? ??????? ????? AcceptChanges ?? ??? DataView ????? ??? ?? ????

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

??? ???? ??????? ???? ??? ????????? ??????:
  1. You use the following code in the application:
    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: ???? ???? ?? ??? ??????? ??? ???? ??????. ?? System.Data.DataView.IsOriginalVersion (Int32 ????) ?? System.Data.DataRowView.get_Item (Int32 ndx) ?? Test.Main() ?? c:\Work\bugs\newbug1\Test.cs:line 42
??????? ?????? ??? ??? ??????? ??? ????? ?? ?????? ??????? ?? ??? ListChanged. ?? ?????? ??????? ????? RowChanged ????? ?? ??????? ListChanged.

????? 2: ????? ???????? ?? ???? ????? ?? ?? ??? ????? ???? ????

??? ?????? ???? ????? ???? ??????? ?? ???? DataSet ?????? ??????? ??? ?? ????? ? ?? ?? ??? ????? ??? ?????? ?? ?????? ??????? ???? ????. ??? ???? ??????? ???? ??? ????????? ??????:
  1. You use the following code in the application:
    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 ??? ?????? ??? ????? ?? 0 ????? ?? 1.

????? 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. You use the following code in the application:
    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. ????? ???????.
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.

????? 4: ??? ???? ????? DataTable ?? ???? ????? ????? ??? '13'

??? ?????? ??????? ????? AcceptChanges ?????? DataSet ????????? ?? ??? ?????? DataTable ?????? ????? ForeignKey ??? AcceptRule.Cascade ??? ?????? ???????? ???? ???????? ?????? DataSet ?? ????. ???? ??? ??????? ??? ????? ???????? ?????????:
  • ????? ?????? DataSet ??? ???? ???? ?? ???? ???? ??? ?????? ??? ????.
  • ??? ??????? ????? AcceptChanges ?????? DataSet.
  • ??? ????? ?????? AcceptRejectRule ?????? DataSet ??? ?????. ??? ????? ??? ?????? ??? ????? ??? ????? ?????? ?????? ???? ???????? ??? ???? ?????? ?? ???? ????????.
??? ???? ??????? ???? ??? ????????? ??????:
  1. You use the following code in the application:
    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 ???????? ?????: '13'.

????? 5: ??? ???? ????? ??? ????? ??? ?? ???? ??? ??? ???? ????? ?? ???? ???????

?? ??? ?? ???? ?? ???? ?? ???? DataTable ?????? ? ??? ?? ???? ????? DataTable.Merge ?? ???? ????? DataSet.Merge ????? ??? ?????? DataSet ?????? DataTable ?? ????.

?????? ????? ??? ????? ?? ?? ???? DataTable ? ??? ????? ?????? DataRowVersion ???? ??? ????????.

??? ???? ??????? ???? ??? ????????? ??????:
  1. You use the following code in the application:
    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. ????? ???????.
?? ??? ?????????? ???? ????? ??? ?????? DataSet ?????? DataTable ????.

??????? ?????? ??? ??? ??????? ???? ?? ???? ??? ???? ?? ?????? DataSet ?????? ???? ????? ??? ?????? ???? DataRowVersion ??? ???????? ??? ??????? ????? DataTable.Merge ?? ????? DataSet.Merge.

????? 6: ?????? ????? ???? DataTable ?? ???? ????? ????? ??? '5'

????? ???????????? ??????? ??? ?? ???? DataTable ?????? ???????? ?? ???? DataTable ??? ????? ??????? ????? ?????? DataTable:
  1. ??? ????? ?????? DataColumn.Expression ?? ????? ??? ?? ?????. ?? ??? ?????????? ??? ????? ???? ???????? ?? ???? DataColumn ??? DBNull.
  2. ????? ??? ??????? ????? DataTable.Clear ??? ????? ???? ???????? ?? ???? DataTable ?? ??? ????? ???????. ??? ???? ?? ??? ????? ????? ???? ??????? ???? DataTable.
??? ???? ??????? ???? ??? ????????? ??????:
  1. You use the following code in the application:
    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:
824684??? ????????? ???????? ????????? ?? ??? ??????? ????? Microsoft

???????

???? ???????: 932491 - ????? ??? ??????: 23/?? ??????/1428 - ??????: 1.8
????? ???
  • Microsoft .NET Framework 2.0
????? ??????: 
kbmt kbfix kbbug kbprb kbexpertiseinter kbexpertisebeginner kbqfe kbpubtypekc KB932491 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????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