Dataset Columns in Wrong Order

Dataset Columns in Wrong Order

Postby jubes » Wed 12 Aug 2009 22:51

I've been wracking my brains all day trying to figure this out. It seems that my dataset gets filled with the last 3 columns being out of order.

Here is my sql statement:
Code: Select all
SELECT items.id,items.sku,order_info_item_binding.editing_name, order_info_item_binding.editing_desc, " +
                      "order_info_item_binding.qty,order_info_item_binding.id,items.uom,order_info_item_binding.item_location_id From order_info " +
                      "LEFT JOIN order_info_item_binding ON order_info.id = order_info_item_binding.order_info_id " +
                      "left join items on items.id = order_info_item_binding.item_id


Here is the code im using to fill the dataset:
Code: Select all
mySqlCommand = mySqlConnection.CreateCommand();
            mySqlCommand.CommandText = cl_commandSets.selectQuery(commandID, where, orderby);
           
            MySqlDataAdapter dataAdapter = new MySqlDataAdapter(mySqlCommand);

            DataSet dataSet = new DataSet();

            dataAdapter.Fill(dataSet);
[/code]

Any help on this would be GREATLY appreciated.
jubes
 
Posts: 2
Joined: Wed 12 Aug 2009 22:46

Postby jubes » Wed 12 Aug 2009 23:31

I figured out the problem. It seems that because two of my columns had the same name 'id' though prefixed in the sql statement with the table name, that this confused things somehow.

I set the first id column with an alias name like SELECT items.id itemsid,items.sku, .... and it seemed to fix the problem.
jubes
 
Posts: 2
Joined: Wed 12 Aug 2009 22:46


Return to dotConnect for MySQL