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

RE: Any Examples of COM (and perhaps ADO)?



Hi Paul,

> What version of MysterX are you using -- try (mx-version).

I was interested and tried the examples Alex gave, using MysterX 103-pr
under DrScheme 103 (using "Graphical Full Scheme (MrEd)".  I experienced
identical symptoms.  Here's the smallest example of the problem I could come
up with:

	(require-library "mysterx.ss" "mysterx")
	(define conn (cci/progid "ADODB.Connection"))
	(com-invoke conn "Open" "DSN=epas;UID=sa;PWD=###")

Running this once works.  The second time you press Execute in DrScheme it
fails, with the "com-invoke (method "Open"): expects type <com-0x0> as 3rd
argument" message.  Something that happens during the first execution screws
up subsequent executions.  These problems on the second execution vary
depending on what happened in the first; the "expected 44 to 94 arguments"
error (with the actual numbers varying) is more common if no parameter is
passed to Open above.

I tried appending some manual cleanup to the above code, in case the problem
had to do with things remaining open that shouldn't:

	(com-invoke conn "Close")	; close the connection object
	(set! conn '())			; clutching at straws

This didn't make any difference.  I was unable to call the COM "Release"
method - an error "IDispatch methods may not be called" was returned.

On the first execution, though, using additional code I was able to
demonstrate that database access was working, up to a point.  I experienced
an unrelated problem which I'll detail in a separate message.

BTW, I tried using "(exit)" to restart the session without having to quit
and restart the whole DrScheme environment after each execution.  This
failed, because subsequent executions complain that CoInitialize has not
been called.

> Is there some way for me to run your experiment here?  What database are
> you using for ADO?

I don't know about Alex, but I tried with both MS SQL Server 6.5, and MS
Access, with identical results.  I assume the problem relates to ADO itself,
not the database.  Re the version of ADO, I'm using MS Data Access
Components (MDAC) version 2.5 (specifically 2.50.4403.12), which is not the
latest version.  However, the ADO objects in MDAC 2.5 have been very stable
for me in production environments, from various client languages.  If I get
a chance, I might try it with the latest MDAC (from
http://www.microsoft.com/data/download.htm).

Having minimal experience with MysterX, out of curiosity I tried using a
non-ADO COM object.  I didn't experience the problem with the following
code:

	(require-library "mysterx.ss" "mysterx")
	(define xml (cci/progid "Msxml2.DOMDocument"))
	(define el (com-invoke xml "createElement" "P"))

This ran repeatedly without problems.  I was also able to add some code to
exercise the object and make sure it was operating correctly.

-Anton