How to use Microsoft ActiveX Data Objects 6.0 Library

iris2009
Member Posts: 56
Hello,
how can I use 'Microsoft ActiveX Data Objects 6.0 Library' in Navision? Where can I find a documentation about it?
I need to read data from Access-Tables.
And I have a specific question: How do I define a "stringformatenum" in nav?? Its the first parameter in the Recordset.GetString()-Function...
or is there another way to read data from rows/fields in a Nav table?
Thanks, Iris
how can I use 'Microsoft ActiveX Data Objects 6.0 Library' in Navision? Where can I find a documentation about it?
I need to read data from Access-Tables.
And I have a specific question: How do I define a "stringformatenum" in nav?? Its the first parameter in the Recordset.GetString()-Function...
or is there another way to read data from rows/fields in a Nav table?
Thanks, Iris
0
Comments
-
Hello Iris!
The ADODB Object (as it is commonly known between developers) is quite easy and straight forward to do what you need.
Basically you need 4 objects (2 are common to any language, 2 are most common in NAV):
- Connection
- Recordset
- Fields
- Field
You must open a Connection in order to use a Recordset.
So the dataflow should be more or less like this:
- Open Connection
- Open Recordset
- Check if Recordset is not empty
- Iterate through Recordset
- Fields = Recordset.Fields;
- Field = Fields.Items(Name of Field)
- Field.Value holds the data for that field
- Close Recordset
- Close Connection.
Here is some fast example I could assemble. This probably is not very optimized but it's a starting point for your tests:CREATE(oConn); CREATE(oRecSet); oConn.Open('Provider=SQLOLEDB.1;Initial Catalog=Oerlikon;Data Source=abbr0116'); gvStrSQL := 'SELECT "CONC Contas".Conta, "CONC Contas".Conciliar '; gvStrSQL += 'FROM Oerlikon.dbo."CONC Contas" "CONC Contas"'; oRecSet.Open(gvStrSQL, oConn, 1, 1); IF NOT oRecSet.EOF THEN BEGIN oFields := oRecSet.Fields; oField := oFields.Item('Conta'); MESSAGE('%1', oField.Value); END;
Marcelo Borges
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions