SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Variables
-
Jun 6, 2011, 23:52 #1
- Join Date
- Jun 2011
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Variables
Hi, what is a difference between:
dim temp
set temp = 1
vs
dim temp
temp = 1
Thanks
-
Jun 7, 2011, 12:20 #2
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
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:
Code:Microsoft VBScript runtime error '800a01a8' Object required: '[number: 1]'
Code:Set oFS = Server.CreateObject("Scripting.FileSystemObject")
-
Jun 8, 2011, 01:30 #3
- Join Date
- Jun 2011
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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?
-
Jun 8, 2011, 14:14 #4
- Join Date
- Aug 2003
- Location
- Land of 10k Lakes
- Posts
- 161
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Jun 8, 2011, 16:30 #5
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
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
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Jun 9, 2011, 13:19 #6
- Join Date
- Aug 2003
- Location
- Land of 10k Lakes
- Posts
- 161
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Bookmarks