2 messages in com.mysql.lists.dotnetRe: Problem with decimal fields in su...
FromSent OnAttachments
Frank31 Jul 2005 02:10 
Pyt31 Jul 2005 22:01 
Subject:Re: Problem with decimal fields in subquery
From:Pyt (py.t@gmail.com)
Date:07/31/2005 10:01:46 PM
List:com.mysql.lists.dotnet

Hi, I have this two tables:

CREATE TABLE `A` ( `cod` int(11) NOT NULL default '0', `descr` varchar(100) default NULL, `aliq` decimal(10,4) default NULL, PRIMARY KEY (`cod`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE `B` ( `cod` int(11) NOT NULL default '0', `cod_a` int(11) default NULL, <-- this 'references' A.cod

... OTHER FIELDS ...

PRIMARY KEY (`cod`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I'm filling a DataSet (via a DataAdapter.Fill() call) with this statement: "SELECT B.*, (SELECT aliq FROM A WHERE cod = B.cod_a) AS aaa FROM B"

As field aliq in table A is DECIMAL I expect to receive a decimal type for aaa in my select, but I receive a casting error and looking at debugger windows in Visual Studio it shows the last Item of the DataRow as System.Double (while other decimal fields are correctly identified as decimal). Am I doing something wrong? Maybe this has something to do with the subquery...