DataGrid showing "System.Byte[]" for a column that should be a str

G

Guest

Ok, I hope this is something easy... but I have been staring at this for way
too long.

I have the following query ( ODBC conn setup to MySQL ):

SELECT MonthName(dateOfOrder) as month, SUM(cost) as sales FROM orderInfo,
imagesInOrder WHERE orderInfo.id=imagesInOrder.order_id Group By
Month(dateOfOrder)

which returns the following when I iterate over the OdbcDataReader:

June, 10.88
July, 22.96
August, 41.06

However, when I bind this query to a DataGrid, the DataGrid shows:

System.Byte[] $10.88
System.Byte[] $22.96
System.Byte[] $41.06

Any ideas? I don't understand why the correct string value ( i.e. the month
name ) is fine when I iterate over the OdbcDataReader, but when I bind it to
a grid it gets messed up?

Thanks much in advance,
Justin
 
M

Mark Harris

Why are you using ODBC to connect to mysql anyway heh, use MySQL.Net to
connect: http://www.sf.net/projects/mysqlnet/ - its an ADODB.Net compliant
library - very good quality ;)

- Mark

Ok, I hope this is something easy... but I have been staring at this for
way
too long.

I have the following query ( ODBC conn setup to MySQL ):

SELECT MonthName(dateOfOrder) as month, SUM(cost) as sales FROM
orderInfo,
imagesInOrder WHERE orderInfo.id=imagesInOrder.order_id Group By
Month(dateOfOrder)

which returns the following when I iterate over the OdbcDataReader:

June, 10.88
July, 22.96
August, 41.06

However, when I bind this query to a DataGrid, the DataGrid shows:

System.Byte[] $10.88
System.Byte[] $22.96
System.Byte[] $41.06

Any ideas? I don't understand why the correct string value ( i.e. the
month
name ) is fine when I iterate over the OdbcDataReader, but when I bind
it to
a grid it gets messed up?

Thanks much in advance,
Justin
 
Joined
Dec 9, 2010
Messages
1
Reaction score
0
I know this is a very old post (found it searching on google) that I'm bumping, but since the only answer is so terrible I thought I'd share a solution I found...

I was having a similar issue:

GROUP_CONCAT(store.store_num) AS store_num was returning System.Byte[] on my datagrid...

Changing it (below) fixed it:

CAST(GROUP_CONCAT(store.store_num) AS CHAR) AS store_num
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top