Re: Non initialized Cmd Parameter Collection via ASP vs SQL Server

Bob Barrows [MVP] wrote:
Lars-Erik wrote:

As a sidenote.. .Refresh does really not seem to be necessary. I've
ran the code without it on my client computer running Vista, and as
long as the command is given type 4, an open connection (or a string,
which is bad practice :P ), and a command name, the roundtrip is made
as soon as you try to access the parameters.

Not in my testing. Of course, I don't have a Vista machine to test it
on, but I'm not really sure why that would make a difference.

Now I have to eat my words. It is right there in the documentation:

If you have not defined your own Parameter objects and you access the
Parameters collection before calling the Refresh method, ADO will
automatically call the method and populate the collection for you.

I'm not sure at what version of ADO this started happening (not that it
matters ...), but it was not the case in earlier versions and I simply
did not notice when it changed.

Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.