Problem retrieve data with join (column order)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
bmsengin
Posts: 1
Joined: Mon 17 Jun 2013 12:48

Problem retrieve data with join (column order)

Post by bmsengin » Mon 17 Jun 2013 13:16

Hi,

Is use this following code :

Code: Select all

DataSet ds = new DataSet();
MySqlDataAdapter myAdapter = new MySqlDataAdapter();
myAdapter.SelectCommand = new MySqlCommand(query, connectionString);
myAdapter.Fill(ds);
Value of query :
select A.ID, A.ACTEURCREATION, A.ACTEURMODIFICATION, A.ACTEURSUPPRESSION, A.DATECREATION, A.DATEMODIFICATION, A.DATESUPPRESSION, A.ETATOBJET, A.RAISONSOCIALE, A.SITEWEB, A.TELEPHONE, A.FAX, A.NUMEROTVA, A.NUMERORC, A.NUMEROAUTORISATION, A.BANQUE, A.IBAN, A.BIC, A.BENEFICIAIREPAIEMENT, A.MAILSERVEUR, A.MAILPORT, A.MAILUTILISATEUR, A.MAILMOTDEPASSE, A.MAILADRESSEEXPEDITEUR, A.ERGONOMIECOULEURFONDMENU, A.ERGONOMIECOULEURTEXTEMENU, A.LOGOMENUHAUT, A.LOGOEDITION, A.PREFIXEREFERENCEFACTURE, A.ESTREFERENCEFACTUREAUTOMATIQUE, A.CONDITIONSGENERALESVENTE, A.PREFIXEREFERENCEOFFRE, A.ESTREFERENCEOFFREAUTOMATIQUE, A.ADRESSEPOSTALE_ID, A.MISSIONPORTANTLESCONGES_ID, A.DOCREPERTOIREDONNEESSERVEUR, A.DOCREPERTOIREMODELESSERVEUR, A.TEXTECONDITIONSPARTICULIERES, A.TEXTEEXONERATIONTVAFOURNITURE, A.TEXTEEXONERATIONTVAPRESTATION, A.TEXTEEXONERATIONTVATOTAL, A.MODEEDITIONCGV, A.ERGONOMIECOULEURFONDENTETEBI, A.ERGONOMIECOULEURTEXTEENTETEBI, A.ERGONOMIECOULEURFONDENTETEBL, A.ERGONOMIECOULEURTEXTEENTETEBL, A.ERGONOMIECOULEURFONDENTETEOFFRE, A.ERGONOMIECOULEURTEXTEENTETEOFFRE, A.ERGONOMIECOULEURFONDENTETEFACTURE, A.ERGONOMIECOULEURTEXTEENTETEFACTURE, A.IBAN2, A.BIC2, A.MAIL, A.CAPITALSOCIAL, A.MISEENPAGE, A.AFFICHERDATEVALIDITESUROFFRE, A.AFFICHERENCARTSIGNATURESUROFFRE, A.IMPRIMANTERELANCEFACTURATION, A.MISSIONPORTANTLESHEURESSUP_ID, A.UNITESCUMULABLES, A.PREFIXEREFERENCEFACTUREFOURNISSEUR, A.ESTREFERENCEFACTUREFOURNISSEURAUTOMATIQUE, A.IBAN3, A.BIC3, A.BANQUE2, A.BANQUE3, A.REPRESENTANTLEGAL, A.MODELEARTICLEDESCRIPTIONPARDEFAUT, A.LANGUE_ID, A.PREFIXEREFERENCECOMMANDEFOURNISSEUR, A.ESTREFERENCECOMMANDEFOURNISSEURAUTOMATIQUE, A.ERGONOMIECOULEURFONDENTETECOMMANDE, A.ERGONOMIECOULEURTEXTEENTETECOMMANDE, A.TACHEREPERTOIRENOUVEAUMAIL, A.TYPEPRESENTATIONIMPUTATIONFACTURECLIENT, A.AFFICHERNUMEROTELEPHONECLIENTSURFACTURECLIENT, A.AFFICHERNUMEROTELEPHONECLIENTSUROFFRE, A.ERGONOMIECOULEURTEXTEMENTIONSLEGALES, A.AFFICHERENCARTSIGNATURESURCONFIRMATIONCOMMANDE, A.MODEINTEGRATIONIMPUTATION, A.COMPTAJOURNALFACTURECLIENT, A.COMPTAJOURNALNOTEDECREDITCLIENT, A.COMPTAJOURNALFACTUREFOURNISSEUR, A.COMPTAJOURNALNOTEDECREDITFOURNISSEUR, A.RELANCEREPERTOIREARCHIVAGECOURRIER,B.ID, B.ACTEURCREATION, B.ACTEURMODIFICATION, B.ACTEURSUPPRESSION, B.CODEPOSTAL, B.COMMUNE, B.COMPLEMENTLOCALISATION, B.DATECREATION, B.DATEMODIFICATION, B.DATESUPPRESSION, B.ETATOBJET, B.NUMERO, B.PAYS_ID, B.VOIE,C.ID, C.ACTEURCREATION, C.ACTEURMODIFICATION, C.ACTEURSUPPRESSION, C.DATECREATION, C.DATEMODIFICATION, C.DATESUPPRESSION, C.ETATOBJET, C.LIBELLE, C.MONTANTPREVISIONNEL, C.STATUT, C.MANAGER_ID, C.DIRECTEUR_ID, C.DESCRIPTION, C.MISSIONMERE_ID, C.CLIENT_ID, C.NONFACTURABLE, C.MONTANTPREVISIONNELFO, (select sum(subMissionTmpFac.MONTANTFOURNITUREHT) from TFACTURE subMissionTmpFac where subMissionTmpFac.ETATOBJET = 1 and subMissionTmpFac.ROLE='TimeSheet.rfl.facture.businessobject.FactureFournisseur' and subMissionTmpFac.MISSION_ID=C.ID) as MONTANTREELFO,D.ID, D.ACTEURCREATION, D.ACTEURMODIFICATION, D.ACTEURSUPPRESSION, D.DATECREATION, D.DATEMODIFICATION, D.DATESUPPRESSION, D.ETATOBJET, D.LIBELLE, D.MONTANTPREVISIONNEL, D.STATUT, D.MANAGER_ID, D.DIRECTEUR_ID, D.DESCRIPTION, D.MISSIONMERE_ID, D.CLIENT_ID, D.NONFACTURABLE, D.MONTANTPREVISIONNELFO, (select sum(subMissionTmpFac.MONTANTFOURNITUREHT) from TFACTURE subMissionTmpFac where subMissionTmpFac.ETATOBJET = 1 and subMissionTmpFac.ROLE='TimeSheet.rfl.facture.businessobject.FactureFournisseur' and subMissionTmpFac.MISSION_ID=D.ID) as MONTANTREELFO from TENTREPRISE A left join TADRESSEPOSTALE B on A.ADRESSEPOSTALE_ID=B.ID left join TMISSION C on A.MISSIONPORTANTLESCONGES_ID=C.ID left join TMISSION D on A.MISSIONPORTANTLESHEURESSUP_ID=D.ID where (A.ID= @ID) and A.ETATOBJET = 1;
And after this code for use the resultset :

Code: Select all

foreach (DataRow dataRow in ds.Tables[0].Rows)
{
     Result result = new Result();
     result.fieldA = dataRow.ItemArray[index + 0].ToString();
     result.fieldB = dataRow.ItemArray[index + 1].ToString();
     ...
}
But, the fields in dataRow.ItemArray seems to be not ordered :

dataRow.ItemArray[index + 0] is A.ID
dataRow.ItemArray[index + 85] is not B.ID ???

Could you help me please ? With the mysql .net connector that's work very welle but i would like to buy devart connector.

Regards,
Gilles

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Re: Problem retrieve data with join (column order)

Post by Pinturiccio » Tue 18 Jun 2013 14:25

Please send us the DDL/DML scripts for all objects used in your query. If these objects depend on other objects that do not participate in the query, please provide their scripts too.

Please also specify your MySQL server and dotConnect for MySQL versions.

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Re: Problem retrieve data with join (column order)

Post by Shalex » Fri 12 Jul 2013 14:58

The bug with column order in DataTable, which is populated by the Fill method of the MySqlDataAdapter object, is fixed. We will post here when the corresponding build of dotConnect for MySQL is available for download.

Shalex
Site Admin
Posts: 8240
Joined: Thu 14 Aug 2008 12:44

Re: Problem retrieve data with join (column order)

Post by Shalex » Thu 18 Jul 2013 15:08

New version of dotConnect for MySQL 7.7 is released!
It can be downloaded from http://www.devart.com/dotconnect/mysql/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=2&t=27557.

Post Reply