Re: How do I trap ADO Recordset events in an ASP script (W2K/IIS5)? by Vince
Vince
Fri Nov 21 07:57:23 CST 2003
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> a écrit dans le message de
news:eJ3F$k1rDHA.3536@tk2msftngp13.phx.gbl...
[...]
> It's a limitation of the scripting engine: an object cannot be declared
> WithEvents because script variables are variants. In order for a variable to
> be defined with events, it has to be defined with a specific object type
> when it is declared, in order for the event model to be set up (different
> object types have different events, right?). You cannot declare a variant
> with events, because the engine has no idea which events might apply.
>
> With client-side code, you have the DOM to work with. The DOM is totally
> separate from the script engines.
Ok, I see now. So the DOM inside MSIE, for instance, is the one that
automatically binds to events on objects I manipulate in a client script.
> Anyways, events are intended to be user-driven, not code-driven. It is
> assumed that the programmer can write code to call when his code does
> something that needs a response.
That's also right. But my point was the following: if you create a class that
has to manipulate an object, which has events, you should not need to define
events of the same kind on your class. Since ADO Recordset can trigger events
when recordset pointer moves I was hoping I could create a class (actually a
server-side script component) that would not need to care about recordset
events. Now I see it has to.
The events I wanted to trap are related to recordsets, not to my class. This
leads to a syntactical contradiction. But I admit your point in that I should
code it different.
Thanks for your help.
Vince C.