Q About Beg. FAQ: Variables In ASP

Results 1 to 3 of 3

Thread: Q About Beg. FAQ: Variables In ASP

  1. #1
    Dan Geiser Guest

    Default Q About Beg. FAQ: Variables In ASP

    Hello,<BR>I am learning ASP for the first time by working my way through the FAQ (for starters). In the Beginners FAQ under "Variables" in ASP <BR><BR>http://www.4guysfromrolla.com/webtech/faq/Beginner/faq4.shtml<BR><BR>the 3rd code segement looks something like the following. <BR><BR>&#060;%@ LANGUAGE="VBSCRIPT" %&#062;<BR>&#060;%<BR> &#039Declare the variable MyName.<BR> Dim MyName<BR><BR> MyName = "Scott Mitchell"<BR><BR> &#039Will print out true<BR> Response.Write(InStr(MyName))<BR>%&#062;<BR><BR>Wh en I try this in my browser I get the error...<BR>====================================== =======<BR>Microsoft VBScript runtime error &#039 800a01c2&#039 <BR><BR>Wrong number of arguments or invalid property assignment: &#039InStr&#039 <BR><BR>/asp/Default.asp, line 17<BR>============================================ =<BR><BR>All of the other code has worked up until now. I noticed the other 2 functions in this code segment are IsNumeric and IsDate. I thought maybe the above should IsStr instead of InStr but that doesn&#039t work either. Does anyone know if the above is valid code? If so, what I am doing wrong? If it&#039s not valid what is the correct code?<BR><BR>Thanks,<BR>Dan Geiser &#060;dgeiser@iname.com&#062; <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Q About Beg. FAQ: Variables In ASP

    You don&#039t need to use the Instr function...<BR><BR>&#039Will print out true<BR>Response.Write(MyName)<BR>

  3. #3
    Karl Guest

    Default The FAQ seems wrong

    InStr requires a minimum of 2 parameters...clearly the FAQ is wrong. There is no function to check whether a variable contains a string or not (as far as I know). If you are curious, the InStr function looks for the first instance of string1 string within another.<BR><BR>for example<BR><BR>instr("hello how&#039s it going?","o") would return a value of 5 since the first "o" within "hello how&#039s it going?" is the 5th character. You can pass it more paramaters..like where to start searching and how to search.<BR><BR>Other IsBLAH functions are:<BR><BR>IsArray<BR>IsDate<BR>IsEmpty<BR>IsNULL <BR>isNumeric<BR>isObject<BR><BR>Hope that clears that up..hope I&#039m not wrong...you should contact scott and let him know!<BR><BR>--<BR>Karl

Posting Permissions

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