Results 1 to 5 of 5

Thread: Variable in ASP

  1. #1
    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0

    Post Variable in ASP

    Hi,

    Need some help pls. Someone said that VB n ASP are quite similiar, but i have some query

    1.In vb 6.0 we have private, public, constant data/variable. How about asp?

    2.How we declare the same data type/variable in asp?


    Thanks in advanced.

    Regards.

    krayon

  2. #2
    Join Date
    Jul 2001
    Location
    KL, Malaysia
    Posts
    277
    Rep Power
    223
    Use Public to declare a public variable, for example:
    Public mypublic

    Use Private to declare a private variable, for example:
    Private myprivate

    Use Const to declare constants, for example:
    Const MYCONSTANTSTRING1 = "this is a constant"
    Const MYCONSTANTSTRING2 = "another constant"

    You may want to look into another keyword called Dim...

  3. #3
    Join Date
    Jul 2002
    Posts
    9
    Rep Power
    0

    Unhappy

    oo..thanks bro..

    but..let say this is how i declare my variable in VB 6.0

    PHP Code:
    public myVariable As Something.Something 
    so it will be like this...???

    PHP Code:
        public myVariable 
        myVariable 
    Server.CreateObject ("Something.Something"
    err.. i try but it doesn't work la..

    best regards.
    krayon

  4. #4
    Join Date
    Dec 2001
    Location
    kl
    Posts
    11
    Rep Power
    0
    Originally posted by kala_krayon
    oo..thanks bro..

    but..let say this is how i declare my variable in VB 6.0

    PHP Code:
    public myVariable As Something.Something 
    so it will be like this...???

    PHP Code:
        public myVariable 
        myVariable 
    Server.CreateObject ("Something.Something"
    err.. i try but it doesn't work la..

    best regards.
    krayon

    If you do this "public myVariable As Something.Something", in VB6
    you need to add the reference, right.

    What you are trying to declare is a COM object. Declaring COM is different from declaring other variables as you need to register it before declaration else error occurs.

    Register COM object is simple. You can use regsvr.exe in your system32 folder to register your dll file OR utilize Microsoft Transaction Server.

    Happy Programming!
    Acurra79

  5. #5
    Join Date
    Oct 2001
    Location
    Melbourne, AU
    Posts
    456
    Rep Power
    225
    I would agree with kpyew.

    But, I would rather leave Const out and just use:

    <%
    Dim MYCONSTANTSTRING2
    MYCONSTANTSTRING2 = "another constant"
    %>

    <% = MYCONSTANTSTRING2 %>

    because const is better used with numbers/integers.

    Dim declares that there is a variable named MYCONSTANTSTRING2. You can also experiment with 'Option Explicit'. This ensures all variables are declared or it forces an error. (This has to be put on the very top of the page before any code)

    I think using WebClasses within ASP is a bit complecated. I think its eaiser to create an IIS app with VB6 then install it on the server... If coding in ASP, it's easier to leave out the classes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JSTL : How to set a variable
    By Chubby21 in forum Website Programming
    Replies: 1
    Last Post: 03-07-2009, 06:21 PM
  2. Can I get a variable name as a string?
    By montyauto in forum Website Programming
    Replies: 3
    Last Post: 06-05-2007, 04:51 AM
  3. how to set session variable for php using dreamweaver
    By vash in forum Website Programming
    Replies: 5
    Last Post: 27-04-2005, 10:17 PM
  4. load variable dari database ke dalam flash
    By cryno in forum Website Design
    Replies: 2
    Last Post: 17-09-2002, 10:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37