AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 05.12.2017, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
alirazazaidi: ODBC connection and Null value Handling Dynamics Ax 2012 R3.
Источник: https://www.tech.alirazazaidi.com/od...cs-ax-2012-r3/
==============

Today I have very small tip to share. I noted down, some odbc connection posts in my blog. All these post shares the code snippets , that used to open odbc connection and did query on SQL server directly. Couple of days ago, I need similar code snippet to read data from SQL server and Insert into another connect. But that code did not had reference to handling null values. So I note down that code snippet too, for future reference.



These all odbc connection , command return results in “ResultSet” class.



This ResultSet  class has method  “wasnull”. According to documentation, its behavior is strange. First we have to call the get method and then we call “WasNull” to verify that value appears is null or not.

https://msdn.microsoft.com/en-us/lib...t.wasnull.aspx



So whole code snippet will be like.

public void run()   { Connection Con = new Connection(); ResultSet R; str sql; Statement Stmt; SqlStatementExecutePermission permission; Real _RealValue; sql = "SELECT * FROM InventTrans "; Stmt = Con.createStatement(); permission = new SqlStatementExecutePermission(sql); permission.assert(); R =Stmt.executeQuery(sql);   while ( R.next() ) { _RealValue =R.getReal(1); if (  R.wasNull(1) ==boolean::false) {   info (" Not null"); } Else { Info (" Null "); }       } CodeAccessPermission::revertAssert();   }

Источник: https://www.tech.alirazazaidi.com/od...cs-ax-2012-r3/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axsa: MDM Adapter - Extending Dynamics AX 2012 R3 Master Data Management Blog bot DAX Blogs 0 22.05.2014 03:28
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 17 Blog bot Dynamics CRM: Blogs 0 10.05.2014 06:30
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 16 Blog bot Dynamics CRM: Blogs 0 23.01.2014 03:15
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
Platform updates overview - 3.70.B - NAV2009 R2 Blog bot Dynamics CRM: Blogs 0 07.02.2011 22:06
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:18.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.