[Mono-list] Various problems in ADO.NET

Alan Tam Tam@SiuLung.com
Mon, 3 Feb 2003 18:42:09 +0800


Here am I again. Finally I succeed using MySqlDataAdapter.Update().

Finally I found that in:
protected virtual int Update (DataRow[] dataRows, DataTableMapping
tableMapping)
it says:
string dsColumnName = columnMappings [parameter.SourceColumn].DataSetColumn;
But columnMappings is an empty collection.
If I use "string dsColumnName = parameter.SourceColumn;" instead, then it can
continue to run.

If I fix this together with the BaseColumnName fix and Aleksey Demakov's patch
(not yet in CVS), then this is the first time I succeed using
MySqlDataAdapter.Update() to update the modified DataTable/DataRow values under
mono with the same code as in the Microsoft Runtime.

Regards,
Alan

----- Original Message -----
From: "Alan Tam" <Tam@SiuLung.com>
To: "Mono-List" <mono-list@ximian.com>
Sent: Monday, February 03, 2003 6:24 PM
Subject: Re: [Mono-list] Various problems in ADO.NET


> Dear All,
>
> I've further traced into the source and found that:
> In private void BuildSchema (IDataReader reader, DataTable table, SchemaType
> schemaType)
> of mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
>
> It says:
> if (schemaRow ["BaseColumnName"].Equals (DBNull.Value))
>     sourceColumnName = DefaultSourceColumnName;
> else
>     sourceColumnName = (string) schemaRow ["BaseColumnName"];
>
> The BaseColumnName field in the Schema table is Null, but the ColumnName
field
> in the table is the correct column name. May I know if it is the problem of
> ByteFX or the mono class library, i.e. is BaseColumnName really the field we
> want?
>
> Thank you.
>
> Regards,
> Alan
>
> ----- Original Message -----
> From: "Alan Tam" <Tam@SiuLung.com>
> To: "Mono-List" <mono-list@ximian.com>
> Sent: Monday, February 03, 2003 3:33 PM
> Subject: [Mono-list] Various problems in ADO.NET
>
>
> > I used this program in both csc/Windows and mcs/Linux:
> >
> > using System;
> > using System.Data;
> > using ByteFX.Data.MySQLClient;
> >
> > public class Test {
> >   public static void Main() {
> >     string connectionString = "...";
> >     MySQLConnection myConnection = new MySQLConnection(connectionString);
> >     myConnection.Open();
> >     DataSet ds = new DataSet("PE");
> >     MySQLDataAdapter adpOE = new MySQLDataAdapter();
> >     adpOE.SelectCommand = new MySQLCommand("SELECT * FROM PE",
myConnection);
> >     adpOE.Fill(ds, "PE");
> >     ds.WriteXmlSchema("PE.xml");
> >   }
> > }
> >
> > This is Linux output:
> > <?xml version="1.0"?>
> > <xs:schema targetNamespace="" xmlns:mstns="" xmlns=""
> > xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
> > attributeFormDefault="qualified" elementFormDefault="qualified"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
> >   <xs:element name="PE" msdata:IsDataSet="true" msdata:Locale="iv">
> >     <xs:complexType>
> >       <xs:choice maxOccurs="unbounded">
> >         <xs:element name="PE">
> >           <xs:complexType>
> >             <xs:sequence>
> >               <xs:element name="Column" type="xs:string" minOccurs="0" />
> >               <xs:element name="Column1" type="xs:string" minOccurs="0" />
> >               <xs:element name="Column2" type="xs:string" minOccurs="0" />
> >               <xs:element name="Column3" type="xs:string" minOccurs="0" />
> >               <xs:element name="Column4" type="xs:string" minOccurs="0" />
> >               <xs:element name="Column5" type="xs:string" minOccurs="0" />
> >               <xs:element name="Column6" type="xs:string" minOccurs="0" />
> >               <xs:element name="Column7" type="xs:
> >
> > This is Windows output:
> > <?xml version="1.0" standalone="yes"?>
> > <xs:schema id="PE" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
> >   <xs:element name="PE" msdata:IsDataSet="true" msdata:Locale="zh-HK">
> >     <xs:complexType>
> >       <xs:choice maxOccurs="unbounded">
> >         <xs:element name="PE">
> >           <xs:complexType>
> >             <xs:sequence>
> >               <xs:element name="PEID" type="xs:int" minOccurs="0" />
> >               <xs:element name="EUID" type="xs:int" minOccurs="0" />
> >               <xs:element name="Heading" type="xs:string" minOccurs="0" />
> >               <xs:element name="DTFrom" type="xs:dateTime" minOccurs="0" />
> >               <xs:element name="DTTo" type="xs:dateTime" minOccurs="0" />
> >               <xs:element name="RepeatFreq" type="xs:int" minOccurs="0" />
> >               <xs:element name="RepeatTimes" type="xs:int" minOccurs="0" />
> >               <xs:element name="Venue" type="xs:string" minOccurs="0" />
> >               <xs:element name="ImportType" type="xs:int" minOccurs="0" />
> >             </xs:sequence>
> >           </xs:complexType>
> >         </xs:element>
> >       </xs:choice>
> >     </xs:complexType>
> >   </xs:element>
> > </xs:schema>
> >
> > The Linux output contains errors on:
> > 1. The file truncates the last <1024 byte octet.
> > 2. The column names are all missing
> > 3. The column types are all wrong.
> >
> > May I know are they all bugs?
> >
> > Regards,
> > Alan
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>