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.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Oct 2006
    Location
    Spain
    Posts
    149
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool error '800a0005'

    Hi,

    I am with a problem in a script for output data from database:

    Error of execution time Microsoft VBScript error '800a0005'

    Call of procedure or invalid argument: 'Right'

    (sometimes is left)


    Someone could help me?

    Thanks

    Lebron

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    You are probably looking at a NULL (or empty) string, which means that it cannot do the string operator.

    Check your output BEFORE the right statement and see if it's empty. If it is, then you may need to do a

    if rs("yourData") <> "" then Right(rs("yourData"),5)
    if rs("yourData") <> "" then Left(rs("yourData"),5)
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Regular Coder
    Join Date
    Oct 2006
    Location
    Spain
    Posts
    149
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Well,

    Although I have written this script sometimes ago I would like you modify it for working well.


    <%
    '{right*****************************************************************}
    myseq = InStr(1, rs.fields("texts"), strKeyword)
    leny = len(trim(strKeyword))
    lenx = len(trim(rs("texts")))
    rightpart = lenX - (myseq +leny)

    new = Right(trim(rs("texts")), rightpart)

    afterx = InStr(2, trim(new), " ")
    plus = Left(new,afterx)
    response.write "<font color=red><b>" & trim(plus) & "</b></font>" & "<BR>"

    '{1left*****************************************************************}
    leftpart = myseq - 1
    beforex = Left(trim(rs("texts")), leftpart+1)
    left = InStrRev(trim(beforex), " ")
    left2 = Mid(beforex,left+1)
    strbefore=left(beforeX,left)
    response.write StrBefore & "<Br>"
    %>
    It will output the right and left part of rs("texts").

    Thank you

    Lebron

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Can you give me an example of what ORIGINAL rs("texts") is (from the database) and what the output should look like? Also, where/what is strKeyword?
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #5
    Regular Coder
    Join Date
    Oct 2006
    Location
    Spain
    Posts
    149
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Are 2 tables - 2 asp files.

    test.asp
    --------

    The user see on the screen all contents of the field "keywords" - keywords are hyperlinks. He click on that and open a new file= results.asp


    results.asp
    _________
    keywords =strkeyword

    <%
    Dim strKeyword
    strKeyword = Request.QueryString("keywords")

    rs.open "SELECT * FROM results where TEXTS like '%" & strKeyword & "%' " %>

    Example of output of rs("texts")


    <A HREF=RESULTS.ASP?keywords=Otawa>Otawa</a>
    <A HREF=RESULTS.ASP?Keywords=the>the</a>
    city
    <A HREF=RESULTS.ASP?Keywords=Canada>Canada</a>



    Lebron

  • #6
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Ah ha! Gotcha...

    Now, one last question (ideas are forming) -- What 'keyword' gets you the MS VBScript error? Any keywords or just one or two?
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #7
    Regular Coder
    Join Date
    Oct 2006
    Location
    Spain
    Posts
    149
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Well,

    Just one or two, especially when "after" or "before" the keywords there is nothing. As in my example is the keyword is "canada" or "Otawa" I see an error message.


    Good luck!

    Lebron

  • #8
    Regular Coder
    Join Date
    Oct 2006
    Location
    Spain
    Posts
    149
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Daemonspyre,

    Could you please now give me the results of your "formed ideas".

    Thanks

    Lebron

  • #9
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Sorry bud. Had to run out of town on business unexpectedly... I will have an answer for you shortly.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #10
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Well, the quick and dirty is that I can make your code a little cleaner, but overall it works very well.

    Changes:

    1) Don't set a variable unless you are going to use it more than 2 times.

    2) Also, your InStr: InStr([start, ]string1, string2[, compare])

    You should start you InStr at 0, not 1. If the Keyword is the first word in the rs("texts"), then you will receive a NULL result.

    Code:
    <%
    '{right*****************************************************************}
    myseq = InStr(0, rs("texts"), strKeyword) 'CHANGED InSTR
    rightpart = len(trim(rs("texts"))) - (myseq + len(trim(strKeyword)))
    new = Right(trim(rs("texts")), rightpart)
    plus = Left(new,InStr(1, trim(new), " "))  'CHANGED InSTR
    response.write "<font color=red><b>" & trim(plus) & "</b></font>" & "<BR>"
    
    '{left*****************************************************************}
    leftpart = myseq - 1
    beforex = Left(trim(rs("texts")), leftpart+1)
    strbefore=left(beforeX,InStrRev(trim(beforex), " "))
    response.write StrBefore & "<Br>"
    %>
    Lastly, it looks as though you are, by the code above, setting the Keyword = RED. You can also do this in JavaScript. However, why fix it if it isn't broken?

    You did a good job here!
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.


  •  

    Posting Permissions

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