• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer
  • Home
  • About
    • linkedin
    • twitter
  • Archive
  • Technical youtube Channel
  • Recommended Readings
  • Free Courses
    • Fixed Asset management Course
    • Financial Modules

Ali Raza Zaidi

Musing's of ERP Consultant

Null handling

ODBC connection and Null value Handling Dynamics Ax 2012 R3.

December 5, 2017 by alirazazaidi

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/library/resultset.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();

 

}

Primary Sidebar

Categories

  • .net framework 2 (24)
  • Accounts Payable (2)
  • AIF Services (6)
  • Ajax (2)
  • asp.net 1.1 (17)
  • asp.net 2 (42)
  • BAM (2)
  • BizTalk (24)
  • Biztalk 2010 (51)
  • BizTalk Errors (10)
  • Biztalk Tools (6)
  • Biztalk White Paper (2)
  • Books (6)
  • Business Intelligence (4)
  • c# (28)
  • Certification Guide (3)
  • Channel 9 Video (2)
  • Customization Tips for D365 for Finance and Operations (54)
  • D365OF (50)
  • Data warehouse Concepts (3)
  • Database Concepts (3)
  • Deployment Errors (5)
  • Dynamics 365 (49)
  • Dynamics 365 for finance and operations (116)
  • Dynamics 365 for Operations (131)
  • Dynamics AX (AX 7) (133)
  • Dynamics AX 2012 (274)
  • Dynamics Ax 2012 Forms (13)
  • Dynamics Ax 2012 functional side (15)
  • Dynamics Ax 2012 Reporting SSRS Reports. (30)
  • Dynamics Ax 2012 Technical Side (50)
  • Dynamics Ax 7 (64)
  • ESB toolkit (4)
  • Exam MB-330: Microsoft Dynamics 365 Supply Chain Management (6)
  • Favorites (12)
  • Financial Modules (6)
  • Functional (6)
  • Lifecycle Services (1)
  • Management Reporter (1)
  • Microsoft Flow (3)
  • MS Dynamics Ax 7 (63)
  • MVP summit (1)
  • MVP summit 2016 (1)
  • New Dynamics Ax (19)
  • Non Defined (9)
  • Power Apps (3)
  • Power BI (12)
  • Power BI Desktop (8)
  • Power Platform (6)
  • Procurement (3)
  • procurement and sourcing (3)
  • Product Information Management (1)
  • Product Management (1)
  • Production Control D365 for Finance and Operations (8)
  • regular expression (3)
  • Sale Order Process (8)
  • Sale Order Processing (8)
  • Sales and Distribution (5)
  • Snagit 2021 (1)
  • Software developer (1)
  • SQL Server 2008 (18)
  • SQL Server 2012 (3)
  • SQL Server 2019 (5)
  • SQL Server and TSQL (5)
  • Sql server reporting services (7)
  • SSIS (13)
  • Tips and tricks (275)
  • TSQL (17)
  • Uncategorized (38)
  • Upgrade (1)
  • VB.net (2)
  • Web Cast (7)
  • White papers (4)
  • Windows form (3)
  • X++ (142)

Secondary Sidebar

Footer

Tags

AIF Aif Services Apps for Dynamics 365 for Operations asp.net AX 7 BizTalk 2010 Biztalk 2010 tips and tricks BizTalk Errors Biztalk Tools c# Customization in Dynamics 365 d d365 for finance and operations D365 for Operations Dynamic AX 2012 Dynamics 365 for finance and operations Dynamics 365 for Operations Dynamics Ax Dynamics Ax 7 Dynamics Ax 2012 Dynamics Ax 2012 development 2 Dynamics Ax 2012 functional side Dynamics Ax 2012 R3 Dynamics Ax 2012 Reporting SSRS Reports. Dynamics Ax 2102 Dynamics Ax tips and tricks Exam MB-330: Microsoft Dynamics 365 Supply Chain Management Excel Add ins financial Dimension Microsoft Dynamics 365 for Operations MSDYN365FO New Dynamics Ax Power BI Power BI tutorial procurement in dynamics ax 2012 Product Management Sales and distribution SQL Server 2008 SSRS Tips and tricks TSQL url regular expression WorkFlow in AX X++ X++ tips

Copyright © 2022 · Magazine Pro On Genesis Framework · WordPress · Log in