In This series of post we will discuss about all possible ways through which we can connect to different databases. 1.ODBC Connection (Open Data Base Connection) 2.ADO Connection (ActiveX Data Objects) 3. OLEDB Connection (Object Linking and Embedding, Database) 4. Connection class 1.ODBC Connection: ODBC used to define a connection between a computer and a database stored on another system. The ODBC connection allows computer user to access the information stored in a database that is not local to that computer. In Dynamics AX, we have ODBCConnection class to carry out this type of database connection need. This class further uses LoginProperty class for login information and uses Statement and ResultSet classes for carrying out DML operations. Here is an example of how to use this class. static void theAxapta_ODBCConnection(Args _args)
In Axapta, we can attach document with Purchase order via document handling, if you need to attached a document using your x++ code, we need to use following x++ AOT objects. DocuRef (table)DocuActionArchive (class)Here is a generic method that will attach record to any table in AX based on parameters passed to it void attachDoc(RefTableId _refTableId, RefRecId _refRecId, selectableDataArea _refCompanyId, FileName _name)
DocuRef docuRef; DocuActionArchive archive; ; docuRef.clear(); docuRef.RefRecId = _refRecId; docuRef.RefTableId = _refTableId; docuRef.RefCompanyId = _refCompanyId; docuRef.Name = _name; docuRef.TypeId = 'File'; docuRef.insert(); archive = new DocuActionArchive(); archive.add(docuRef, _name); } To use this method write following code to attache the document.