-
SO einfach ist es nun auch wieder nicht.
Du musst im VBA-Editor dem Excel über "Extras->Verweise" die Komponente "Microsoft ActiveX Dataaccess 2.7" oder höher zuordnen.
Dann definierst du
public function GetPreis(Artikel as string) as double
static myConnect as new ADODB.Connection
static myCommand as new ADODB.Command
static myRecord as new ADODB.Recordset
with myConnect
if .state = adstateclosed then
.connectionstring="DSN=AS400"
.open
endif
end with
with myCommand
if .activeconnection is nothing then
.commandtext="SELECT IDTLPD.DTLPLE FROM LDBSVR1.IBOL01AD.IDTLPD IDTLPD WHERE IDTLPD.DTLNR=?"
set .activeconnection=myConnect
endif
end with
myCommand(0) = Artikel
with myRecord
if .state=adstateclosed then
.open mycommand
else
.requery
endif
if .eof = false then
GetPreis = myRecord(0)
endif
end with
end function
Dieser Code erhebt jetzt keinen Anspruch auf Vollständigkeit.
Durch die Static-Definition der Variablen bleibt die Verbindung erhalten, auch wenn die Funktion verlassen wird.
Last edited by Fuerchau; 21-09-04 at 19:28.
Similar Threads
-
By KingofKning in forum IBM i Hauptforum
Antworten: 7
Letzter Beitrag: 23-10-06, 17:10
-
By guru30 in forum IBM i Hauptforum
Antworten: 3
Letzter Beitrag: 17-10-06, 11:58
-
By boco25 in forum IBM i Hauptforum
Antworten: 5
Letzter Beitrag: 20-06-06, 15:51
-
By .max.0r in forum NEWSboard Windows
Antworten: 16
Letzter Beitrag: 11-05-06, 14:47
-
By Koelch400 in forum IBM i Hauptforum
Antworten: 7
Letzter Beitrag: 23-05-02, 21:38
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks