James Paterson
James Paterson

Reputation: 100

Difference between two similar pieces of Classic ASP code

A page I'm working on uses some ASP to download a file. Depending on some condition, it will use one of two ASP files. There is only one small difference between the files.

The first one:

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1

And the second:

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open

What is the difference between these two? I wouldn't think that setting the stream's type before or after opening it would really matter.

Upvotes: 0

Views: 109

Answers (1)

Kul-Tigin
Kul-Tigin

Reputation: 16950

https://msdn.microsoft.com/en-us/library/windows/desktop/ms681553%28v=vs.85%29.aspx

The Type property is read/write only when the current position is at the beginning of the Stream (Position is 0), and read-only at any other position.

So, if you can change it you can change it. It does not matter changing it after or before the invoking Open method.

Upvotes: 3

Related Questions