
{"id":190,"date":"2017-04-11T11:11:08","date_gmt":"2017-04-11T01:11:08","guid":{"rendered":"http:\/\/bakke.online\/?p=190"},"modified":"2017-04-11T11:11:08","modified_gmt":"2017-04-11T01:11:08","slug":"retrieving-double-fields-from-ado-net-in-cil-code","status":"publish","type":"post","link":"https:\/\/www.bakke.online\/index.php\/2017\/04\/11\/retrieving-double-fields-from-ado-net-in-cil-code\/","title":{"rendered":"Retrieving Double fields from ADO.NET in CIL code"},"content":{"rendered":"<p>I recently wrote about how to retrieve <a href=\"https:\/\/www.bakke.online\/index.php\/2017\/04\/07\/retrieving-datedatetime-from-ado-net-into-a-record-field\/\">DateTime fields from ADO.NET<\/a>.<\/p>\n<p>If your code is running in CIL, there are some more gotchas, as some conversions that work just fine in X++ will fail when running in CIL.<\/p>\n<p>If you try to retrieve a Double value from ADO.NET and assign it to a record buffer field, the code may run just fine in X++ but when running in CIL you may get this error message:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-104\" src=\"https:\/\/www.bakke.online\/wp-content\/uploads\/2017\/04\/wrongtype-300x62.png\" alt=\"\" width=\"300\" height=\"62\" \/><\/p>\n<blockquote><p>Error executing code: Wrong argument types in variable assignment.<\/p><\/blockquote>\n<p>To work around this, use a local bounce variable of type System.Double, then assign that to the record field like this:<\/p>\n<pre>System.Double clrDouble;\n\n...\n\nclrDouble = reader.get_Item( <span style=\"color: #993300;\">\"UNITPRICE\"<\/span>\u00a0);\nitem.Price = clrDouble;<\/pre>\n<p>There are likely to be other data types causing problems in CIL mode, so I&#8217;ll keep posting as I come across them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently wrote about how to retrieve DateTime fields from ADO.NET. If your code is running in CIL, there are some more gotchas, as some conversions that work just fine in X++ will fail when running in CIL. If you try to retrieve a Double value from ADO.NET and assign it to a record buffer &hellip; <a href=\"https:\/\/www.bakke.online\/index.php\/2017\/04\/11\/retrieving-double-fields-from-ado-net-in-cil-code\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Retrieving Double fields from ADO.NET in CIL code&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[2,18,3,11],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-dynamics-ax","category-uncategorized","tag-ax2012r3","tag-cil","tag-dynamics-ax","tag-imports"],"_links":{"self":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":0,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bakke.online\/index.php\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}