read data from a database

iqbalmad
Member Posts: 180
[Some non-English text removed by Administrator]
NavAdoConnection (Automation) 'Microsoft ActiveX Data Objects 2.8 Library'.Connection
OConnection (Text ) 250
OSql (Text) 250
NavRec (Automation ) 'Microsoft ActiveX Data Objects 2.8 Library'.Recordset
Puis voici le code à utiliser :
// Connexion à la base de données.
OConnection:='PROVIDER=SQLOLEDB;SERVER=SERVEURSQLSERVER;DATABASE=Nombasededonnées;UID=Utilisateur;PWD=Motdepasse';
// Création de l'objet automation
if isclear(NavAdoConnection) then
CREATE(NavAdoConnection);
// Ouverture de la connexion.
NavAdoConnection.ConnectionString(OConnection);
NavAdoConnection.Open;
// Ouverture recordset
// OSql = requête que vous souhaitez réaliser.
OSql:='Select [No_] as no, name from [CRONUS France S_A_$Customer] order by name';
// Création de l'objet automation
if isclear(NavRec) then
CREATE(NavRec);
NavRec:=NavAdoConnection.Execute(OSql,OReturnNbRecord);
// On se positionne sur le premier enregistrement.
NavRec.MoveFirst;
REPEAT
// On se déplace sur l'enregistrement suivant.
NavRec.MoveNext;
// Jusqu'à la fin de fichier.
UNTIL NavRec.EOF;
// Fermeture de la connexion.
NavAdoConnection.Close;
// Libération des objets automation.
CLEAR(NavAdoConnection);
CLEAR(NavRec);
I found these codes on the net. But this is no more applicable on NAV 2013.
Can you please guide as to how i write sql commands on NAV to read data from an SQL db.
Thanks.
NavAdoConnection (Automation) 'Microsoft ActiveX Data Objects 2.8 Library'.Connection
OConnection (Text ) 250
OSql (Text) 250
NavRec (Automation ) 'Microsoft ActiveX Data Objects 2.8 Library'.Recordset
Puis voici le code à utiliser :
// Connexion à la base de données.
OConnection:='PROVIDER=SQLOLEDB;SERVER=SERVEURSQLSERVER;DATABASE=Nombasededonnées;UID=Utilisateur;PWD=Motdepasse';
// Création de l'objet automation
if isclear(NavAdoConnection) then
CREATE(NavAdoConnection);
// Ouverture de la connexion.
NavAdoConnection.ConnectionString(OConnection);
NavAdoConnection.Open;
// Ouverture recordset
// OSql = requête que vous souhaitez réaliser.
OSql:='Select [No_] as no, name from [CRONUS France S_A_$Customer] order by name';
// Création de l'objet automation
if isclear(NavRec) then
CREATE(NavRec);
NavRec:=NavAdoConnection.Execute(OSql,OReturnNbRecord);
// On se positionne sur le premier enregistrement.
NavRec.MoveFirst;
REPEAT
// On se déplace sur l'enregistrement suivant.
NavRec.MoveNext;
// Jusqu'à la fin de fichier.
UNTIL NavRec.EOF;
// Fermeture de la connexion.
NavAdoConnection.Close;
// Libération des objets automation.
CLEAR(NavAdoConnection);
CLEAR(NavRec);
I found these codes on the net. But this is no more applicable on NAV 2013.
Can you please guide as to how i write sql commands on NAV to read data from an SQL db.
Thanks.
0
Comments
-
Queries? Or you mean non-nav db? If so - use .NET. There must be a methods to connect and read sql data.0
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