[Mono-devel-list] Returntype of System.Data.DataTable.Select

Konstantin Triger kostat at mainsoft.com
Wed Apr 13 04:10:40 EDT 2005


Hello,

Attached the RegionDataSet.cs and a region.xml files.
When the following code is run, this type should be outputted: 
tests.RegionDataSet+RegionRow

static void testTypedDS() {
            RegionDataSet regionDataSet1 = new RegionDataSet();
            regionDataSet1.ReadXml(@"region.xml", XmlReadMode.DiffGram);
            DataRow[] rows = regionDataSet1.Tables[0].Select("RegionID > 
0");
            Console.WriteLine(rows[0].GetType().ToString());
        }

BTW, this fix, along with many others fixes by Mainsoft are currently 
being reviewed by Uma and Suresh and will be available soon to dev-list 
review (not in the HEAD branch).

Regards,
Konstantin Triger



Atsushi Eno wrote:

> Hello,
>
> gerhard at ibrittweger.de wrote:
>
>> I think there is an error in System.Data.DataTable.Select 
>> (IExpression filter, SortableColumn [] sortableColumns, 
>> DataViewRowState recordStates)
>>
>> If you use a typed dataset with your own Datarow class derived from 
>> DataRow und
>> use an Select on your DataTable class derived from DataTable the 
>> select has to
>> return an array of your DataRows insteat of base-Class Datarows.
>
>
> Why?
>
>> In DataTable.cs Line 1317
>> DataRow[] dataRows = (DataRow[])rowList.ToArray(typeof(DataRow));
>>
>> typeof(DataRow) has to be replaced by GetRowType()
>>
>> DataRow[] dataRows = (DataRow[])rowList.ToArray(GetRowType());
>
>
> Am attaching an example case that the existing expression is not
> wrong by concept.
>
> If you have concrete example case, please enter it to bugzilla.
>
> ----
> using System;
> using System.Collections;
> using System.Xml;
>
> public class Test {
>   public static void Main () {
>     ArrayList al = new ArrayList ();
>     XmlDocument doc = new XmlDocument ();
>     al.Add (doc.CreateElement ("foo"));
>     al.Add (doc.CreateAttribute ("attr"));
>     al.Add (doc.CreateEntityReference ("ent"));
>     XmlNode [] nodes = (XmlNode []) al.ToArray (typeof (XmlNode));
>   }
> }
>
> Atsushi Eno
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: region.xml
Type: text/xml
Size: 1038 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050413/0b75b995/attachment.xml 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RegionDataSet.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050413/0b75b995/attachment.pl 


More information about the Mono-devel-list mailing list