Hi, what is a difference between:
dim temp
set temp = 1
vs
dim temp
temp = 1
Thanks![]()
| SitePoint Sponsor |
Hi, what is a difference between:
dim temp
set temp = 1
vs
dim temp
temp = 1
Thanks![]()





Set is used for creating an instance of an Object, not a variable.
If you use Option Explicit you'll probably find that the first example throws an error.Something like:
An example of setting an instance of an object is:Code:Microsoft VBScript runtime error '800a01a8' Object required: '[number: 1]'
Code:Set oFS = Server.CreateObject("Scripting.FileSystemObject")
Thanks for help.
I have one more problem in my script:
I declared variable:
dim sqlCount, dynCount
dim count
dim maxCount
count = 0
maxCount = 7000
next I execute sql for count records in table of my database:
sqlCount = "select count(*) NUMROWS from table"
set dynCount = session("OraDatabase").createdynaset(sqlCount, 0)
count = dynCount.Fields("NUMROWS").Value
set dynCount = nothing
and in IF statement:
if count>maxCount then ...
always is true even variable "count" is smaller then maxCount. I make something wrong?



I'd be adverse to using "count" as a variable name. As it has special meaning in a db query I'm afraid I'd mess up somewhere and get unpredictable results if not outright errors. Worse case - I wouldn't notice right away![]()

Bookmarks