473,668 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Private Subroutines

In ASP, if I define a subroutine as private

Private Sub mySubroutine(ar g1, arg2)

I understand that the variables I define inside the subroutine are local only to the
subroutine. If the same variable is defined outside the subroutine, it won't conflict
(right?)

What about variables that are defined outside the subroutine, but not inside? Are they
available inside the subroutine?

Thanks,

Vic
Aug 25 '06 #1
5 1834
On 25/08/2006 01:55, Victor wrote:
In ASP, if I define a subroutine as private

Private Sub mySubroutine(ar g1, arg2)

I understand that the variables I define inside the subroutine are local only to the
subroutine. If the same variable is defined outside the subroutine, it won't conflict
(right?)

What about variables that are defined outside the subroutine, but not inside? Are they
available inside the subroutine?

Thanks,

Vic

Er, why not try it and find out ;-)
Aug 25 '06 #2
Victor wrote:
In ASP,
I assume you mean "vbscript", not "ASP"
if I define a subroutine as private

Private Sub mySubroutine(ar g1, arg2)

I understand that the variables I define inside the subroutine are
local only to the subroutine. If the same variable is defined outside
the subroutine, it won't conflict (right?)
Test it:
>
What about variables that are defined outside the subroutine, but not
inside? Are they available inside the subroutine?
Yes, variables assigned outside subroutines are global.

Here's a simple test:
<%
Dim x
x=1
response.write "outside - before call to foo: " & x & "<BR>"
foo
response.write "outside - after call to foo: " & x & "<BR>"
foo2
response.write "outside - after call to foo2: " & x & "<BR>"

sub foo()
dim x
x="inside foo"
response.write x & "<BR>"
end sub

sub foo2()
Response.Write "inside foo2 - initial value of x: " & x & "<BR>"
x=x+1
Response.Write "inside foo2 - final value of x: " & x & "<BR>"
end sub
%>
Do you have the vbscript documentation? If not, you can get it here:
http://tinyurl.com/7rk6

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 25 '06 #3

"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcomwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
:
Do you have the vbscript documentation? If not, you can get it here:
http://tinyurl.com/7rk6
Bob, this has been a BIG help to me today, THANKS!

Are there .CFM files for database stuff, like SQL? I've been looking, can't find them.

Thanks again,

Vic
(very new)

Aug 25 '06 #4
Victor wrote:
"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcomwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>
Do you have the vbscript documentation? If not, you can get it here:
http://tinyurl.com/7rk6

Bob, this has been a BIG help to me today, THANKS!

Are there .CFM files for database stuff, like SQL? I've been looking,
can't find them.
Which database?

SQL Server (Books OnLine - aka BOL) documentation can be found here:
http://www.microsoft.com/sql/techinf...2000/books.asp

For Access, you need to use the online help.

Or are you asking for sql language help in general? I know of no generic
online source of sql assistance.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Aug 26 '06 #5
"Bob Barrows [MVP]" wrote...
Victor wrote:
"Bob Barrows [MVP]" wrote...
>
Do you have the vbscript documentation? If not, you can get it here:
http://tinyurl.com/7rk6
Bob, this has been a BIG help to me today, THANKS!

Are there .CFM files for database stuff, like SQL? I've been looking,
can't find them.
Which database?

SQL Server (Books OnLine - aka BOL) documentation can be found here:
http://www.microsoft.com/sql/techinf...2000/books.asp

For Access, you need to use the online help.

Or are you asking for sql language help in general? I know of no generic
online source of sql assistance.
SQL Server or SQL Language. Actually, I'm partial to the MS help file format because
it's easy to use and very easy search, and I can efficiently use them when my laptop is
on battery and not connected to the internet.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Aug 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
3798
by: gabor | last post by:
hi, as far as i know in python there aren't any private (i mean not accessible from the outside of the object) methods/fields. why? in java/c++ i can make a method private, this way unaccessible for the outside world. i think it helps a lot to make for example a library more robust.
3
2740
by: joe | last post by:
Hello: I am using IIS 5.0, ASP and VBScript. I am puzzled by recurrences of errors when I nest subroutines, and I'd like to know if there are rules for that which I don't know. Would functions work better instead? I am not much of a coder, so forgive my ignorance.
8
5541
by: MLH | last post by:
What's the default declaration if Public/Private is ommited from the Sub statement in an Access 97 procedure?
3
2128
by: Bob Day | last post by:
Ok, I have done a lot of reading(of the newsgroup answers, help files and MSDN articles) of synclock. I understand what you are saying in the newsgroup, and it is very helpful. It does, however, directly contradict what the VS 2003 help file says, and it seems that various posters to my original questions on Synclock disagree with each other. It seems, that the best practice is to use sysnlock to protect code, not variables. That...
7
2996
by: Microsoft | last post by:
I'm not sure where to physically place my subroutines in vb.net I get namespace and not declared errors... Imports System Imports System.Management Public Class Form1
3
1367
by: OpticTygre | last post by:
I have a class, ProcessFiles, with several subroutines it runs for each type of file I want to "process." First, I check directories for files. Then, based on the filenames of those I find in the directory, I do IP address lookups from a database to see where these files need to be sent. After I lookup the IP addresses, I dimension a new class (ProcessThreads), and call ProcessThreads.Process for each IP I pull out of the database. In...
2
1611
by: dumbo | last post by:
Hello, who gives one more shining solution to me? My application load form "A". The form "A" by means of a push-button load form "B" that in its turn by means of a push-button load form "C". Form "B" contains one variable "Private" "VarB". How I can read the value of "VarB" from form "C"? All the form come loaded with the following brace of instructions: Sub Button2_Click(ByVal sender As System.Object, ByVal and As System.EventArgs)...
1
1717
by: Wijaya Edward | last post by:
Hi, How does one benchmark multiple subroutines in Python? Is there a built-in library for that? -- Regards, Edward WIJAYA SINGAPORE
10
2908
by: liz0001 | last post by:
Hi, I need to access an .asp subroutine file from a subdomain. i.e. the website is at www.domain.com and I want to access the same subroutines on the subdomain mobile.domain.com. The normal #include and #virtual don't seem to be working remotely. I have also tried:
0
8371
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8652
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2782
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.