[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any Examples of COM (and perhaps ADO)?



Does anyone have any examples of COM use (with ADO would be nice).

I am having trouble and the documentation is "sparse" on argument passing
and retrieving.

As an experiment I try:

(require-library "mysterx.ss" "mysterx")
(define conn (cci/progid "ADODB.Connection"))
(define cmd (cci/progid "ADODB.Command"))
(define rs (cci/progid "ADODB.Recordset"))

(com-set-property! conn "ConnectionString" "DSN=MILPITAS;UID=XSG;PWD=###")
(com-invoke conn "Open" com-omit )
(com-set-property! cmd "ActiveConnection" conn)
(com-set-property! cmd "CommandText" "SELECT * FROM BILL_CODE")

(set! rs (com-invoke cmd "Execute"))

(display (com-get-property rs "RecordCount"))

returns -1



With the above after the first "Execute" , I get:

com-get-property (property "RecordCount"): expects 3 arguments, given 2:
#<com-object> "RecordCount"

or

com-set-property! (property "ConnectionString"): expects 44 to 94 arguments,
given 3: #<com-object> "ConnectionString" "DSN=MILPITAS;UID=XSG;PWD=###"

or

com-set-property! (property "ConnectionString"): expects 2 arguments, given
3: #<com-object> "ConnectionString" "DSN=MILPITAS;UID=XSG;PWD=###"

On a run with (com-invoke conn "Open" "DSN=MILPITAS;UID=XSG;PWD=###") I get:

com-invoke (method "Open"): expects type <com-0x0> as 3rd argument, given:
"DSN=MILPITAS;UID=XSG;PWD=###"; other arguments were: #<com-object> "Open"
(I can find no reference to <com-0x0>)

If I run this after an error DrScheme causes a protection fault, so I must
be doing something wrong.
The instruction at "0x10004e68" referenced memory at "0x00320491". The
memory could not be "read"