Reading external databases through ADO
This is an example of reading exernal databases through ADO (in Navision).
This example addresses typical problems:
- NULL values
- type conversion
- spaces in result set field names
http://www.mibuso.com/dlinfo.asp?FileID=589
Discuss this download here.
Comments
RIS Plus, LLC
Instead of hard coding the filed names of sql db table
I am storing the field names in an array. and try to get the values
as follows
ADORecSet.Open(SQLString,ADO);
ADOFieldSet:=ADORecSet.Fields;
IF NOT ADORecSet.EOF THEN BEGIN
FOR i:= 1 TO Index-1 DO BEGIN
SQLFieldValues:=FORMAT(ADOFieldSet.Item('+
SQLFieldNames+').Value);
END;
END;
But its throwing me the error
The call to member item failed. ADODB.fields returned the following:
Item cannot be found in the collection corresponding to the requested name or ordinal
can't we make this process dynamically.
do you have any example how to write to external database?
Here are some posts with the execute statement:
http://www.mibuso.com/forum/viewtopic.php?t=9995&highlight=
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
You do not have permission to run the 'ADO test' Codeunit.
If I to open for design it says read instead of run.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I read about many docs here, but I did not find about the schemas.
I would like to show up for the users the database tables (name, etc) to a temporary table after than the user can select a table from the current database. I've made the connection but how can I receive the table names in the database? :roll:
If any links here, it will be good too!
Thanks a lot!
A
But I’m afraid I’m missing the most simple of concepts. When I run the solution I am returned an error: ](*,) “The length of the text string exceeds the size of the string buffer’.
I’m not sure if that is what is expected, or if I should correct something to eliminate the error. It seems that I am the only one with this problem. :oops: Can you help me understand the point that I am missing?
I'm running SQL2008r2, NAV5.01update2 with "Microsoft ActiveX Data Objects 2.8 Library"
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n