Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts

    whats this in asp?

    hi all,
    can someone tell me whats the keyword/reserved word in asp for these two php reserved words:

    Code:
    $_GET["something"];
    $_POST["something"];
    really need to know....anyone???? urgent here....

    thanks
    Warm Regards,
    Mivec

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    My PHP isn't much but I think what you want is:

    request.querystring("something")
    request.form("something")

  • #3
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Spudhead
    My PHP isn't much but I think what you want is:

    request.querystring("something")
    request.form("something")
    hmm....ok...i think that will work....by the way, another translation from php to asp required:

    Code:
    1)!ISSET(something) in asp?
    2)also whats the switch-case syntax for asp?
    sorry for the noobish questions....but i rally am a noob IN asp......sigh....

    cheers
    Warm Regards,
    Mivec

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    1. IsNull (varname)

    2.
    Code:
    Select Case varname
       Case 1
          ' do something
       Case 3
          ' do something else
       Case Else
          ' default
    End Select

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #5
    New Coder
    Join Date
    Aug 2005
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    1. IsEmpty(var) ???

  • #6
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    If var = "" then
    its empty!
    end if

    Assuming what I understand correctly IsEmpty to actually do.
    OracleGuy

  • #7
    New Coder
    Join Date
    Aug 2005
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes oracle, its the same.

    @nikkiH:
    You will never get a NULL for a request.form or request.querystring.
    NULL is different from an empty string.

  • #8
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    He asked for the equivalent to isset (which checks for the existence of a variable: php does not make you declare variables), not checking a value for empty string (String.Empty in .net).

    Since VBscript always inits variables to null (IIRC, since all are Variant type), you'd test for null. And I ALWAYS use option explicit, which forces variable declaration.

    http://us2.php.net/isset
    http://www.w3schools.com/vbscript/func_isnull.asp

    If it is a string, yeah, you could just do the comparison as was suggested.
    if var = "" then
    ' do something
    end if
    Last edited by nikkiH; 08-18-2005 at 09:12 PM.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #9
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks guys...will test it out in a bit..anyway...there is one more that i need to know from php to asp:

    Code:
    date("YmdHis");
    cheers
    Warm Regards,
    Mivec

  • #10
    New Coder
    Join Date
    Aug 2005
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,


    "FormatDateTime" is right for you.

    Look in your documents for detailed datetime-formats with this command.


    cheers

  • #11
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Cyberlord
    Hello,


    "FormatDateTime" is right for you.

    Look in your documents for detailed datetime-formats with this command.


    cheers
    err.....thanks cyberlord but could i have an exmaple how to declare it??like in php its :

    Code:
    $var = date("YmdHis");
    so maybe need some help here on how to exactly declare it....noob in asp..really sorry...
    Warm Regards,
    Mivec

  • #12
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts

    another...really sorry

    another one....really sorry.....in php it is :

    Code:
    $var->affectedRows()
    so what is it like in asp? really for asking these questions.....hopefully u can be patient with me...thanking u all in advance.

    cheers
    Warm Regards,
    Mivec

  • #13
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    checking if a variable exists should technically be IsEmpty() but IsNull() returns the same as if it doesnt exist it has a null value (the difference is in option explicit) and = "" is just cos as it is variant type when it has null value it comes out as "" or 0

    as for the date function there is no intrinsic asp function to format the date, you have to make your own (i made a big function a while ago to mimic phps as the only useful functions i could find in php not asp were mail() and date())

    asp has Now() Time() and Date() to get the current datetime time and date respectively, FormatDateTime(Date(), vbLongDate) returns a string for example 20 August 2005. there are functions such as Year() Hour() etc which will return one element of the date. also check out the CDate() function to convert strings etc into variant of subtype date for this sort of function.. adding 1 to a date is 1 day)

    please look at the links in my signature and http://www.w3schools.com/asp for further help. (in particular look at the link in the [D] in my sig, this is for vbscript so is slightly diff from asp but its pretty much the same, all the same functions etc but u shud use some serverfunctions eg Server.CreateObject() instead of just CreateObject() and ofc things like MsgBox() and WSH are not available in asp (i think wsh isnt anyway)

    i cant remember what $var->affectedRows() does so i cant really tell you what it is in asp

  • #14
    Regular Coder
    Join Date
    Feb 2004
    Location
    Malaysia
    Posts
    175
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by ghell
    checking if a variable exists should technically be IsEmpty() but IsNull() returns the same as if it doesnt exist it has a null value (the difference is in option explicit) and = "" is just cos as it is variant type when it has null value it comes out as "" or 0

    as for the date function there is no intrinsic asp function to format the date, you have to make your own (i made a big function a while ago to mimic phps as the only useful functions i could find in php not asp were mail() and date())

    asp has Now() Time() and Date() to get the current datetime time and date respectively, FormatDateTime(Date(), vbLongDate) returns a string for example 20 August 2005. there are functions such as Year() Hour() etc which will return one element of the date. also check out the CDate() function to convert strings etc into variant of subtype date for this sort of function.. adding 1 to a date is 1 day)

    please look at the links in my signature and http://www.w3schools.com/asp for further help. (in particular look at the link in the [D] in my sig, this is for vbscript so is slightly diff from asp but its pretty much the same, all the same functions etc but u shud use some serverfunctions eg Server.CreateObject() instead of just CreateObject() and ofc things like MsgBox() and WSH are not available in asp (i think wsh isnt anyway)

    i cant remember what $var->affectedRows() does so i cant really tell you what it is in asp
    the $var->affectedRows() will return an integer value. what it does is that if ur statement does any changes to any of the records that u have selected, it will return an integer value. how it's used is like this:

    Code:
    if ($var->affectedRows() > 0)
     echo ("stuff edited");
    else 
     echo("stuff not edited");
    so as u can see, it will return a value saying that it is true and if not it will go to not true......dunno if i am explaining it the right way....
    so how can i do it in asp?

    cheers
    Warm Regards,
    Mivec

  • #15
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    id just use the optional second argument in objConn.Execute(strSQL, intAffectedRows)

    (ive never actually used it but thats what the documentation says, i assume it just puts the number of affected rows into that variable)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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