Grabbing table columns tutorial - problem

Results 1 to 2 of 2

Thread: Grabbing table columns tutorial - problem

  1. #1
    Join Date
    Dec 1969

    Default Grabbing table columns tutorial - problem

    I&#039;ve just read the excellent article on grabbing table<BR>columns from other sites<BR><BR>I&#039;m having a little trouble in getting my page to work. When I do fire the page up I get the following error message <BR><BR>Error Type:<BR>Microsoft VBScript compilation (0x800A03F2)<BR>Expected identifier<BR>/cuesport/test5.asp, line 10, column 17<BR>Function GetCell(10, http://****.com)<BR>----------------^<BR><BR><BR>I know this may seem a really dumb question, but does anyone have any ideas on what I&#039;ve done wrong?<BR><BR>Any help would be most welcome<BR><BR>Kindest Regards<BR>Karl<BR>

  2. #2
    Join Date
    Dec 1969

    Default Understanding subroutines

    There are *two* steps to using a subroutine (in VBScript, subroutines come in two flavors: FUNCTIONs and SUBs).<BR><BR>(1) Defining the function.<BR>(2) Calling the function.<BR><BR>And you seem to have the two steps mixed up.<BR><BR>When you *define* a function--that is, when you write the code that says what to do when the function indeed gets called--the first line is a "function declaration." <BR><BR>And it takes the form:<BR><BR>FUNCTION &#060;function name&#062;( [ &#060;argument name&#062; [, &#060;argument name&#062; [...] ] )<BR><BR>where "function name" and "argument name" are any names of your choice (so long as they don&#039;t conflict with other names, including the built-in names of VBscript).<BR><BR>So, for example, you could have a function defined thus:<BR>&nbsp; &nbsp; Function GetCell( cellNumber, url )<BR><BR>But you *can&#039;t* have it defined like *you* did:<BR>&nbsp; &nbsp; Function GetCell(10, http://****.com)<BR><BR>Because:<BR>(a) 10 is not a name, it is a constant number<BR>(b) http://****.com is not a name, either. It is a "constant".<BR><BR>*NOW*...<BR><BR>*AFTER* you have defined the function in the right way, *THEN* when you call it you can use *either* variable names or constants in the places where the names (only) were used in the definition. So you *might* very well do<BR><BR>&nbsp; &nbsp; Call GetCell( 10, "http://****.com" )<BR>or<BR>&nbsp; &nbsp; cnum = 10<BR>&nbsp; &nbsp; **** = "http://****.com"<BR>&nbsp; &nbsp; cellContents = GetCell( cnum, **** )<BR>or any of dozens of other possibilities.<BR><BR>ANYWAY...<BR><BR>If you didn&#039;t understand the concepts of subroutine definitions and invocations, then it&#039;s time to get a *GOOD* VBScript book (tutorial) and start learning, learning, learning. At a bare bones minimum, you should do the "beginner&#039;s lessons" at<BR><BR>

Posting Permissions

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