Results 1 to 2 of 2

Thread: Ad Hoc Formulas

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Houston
    Posts
    9

    Question

    I've got a design dilema. I need to add the capabilites to a web site to allow the users to input metric conversion formulas into SQL server, extract the formulas from the database and use them with values passed to an ASP page. The problem I'm having is I don't know how to get either SQL Server or the ASP page (vbscript) to use the formula extracted from the database as a mathematical function.

    If there is a solution in Visual Basic, I can easily add an ActiveX control to the web page to get the desired result.

    There probably is no alternative to parsing the string of characters extracted from the database, but if someone does know how to get either SQL Server, VBScript or Visual Basic to recognize the string as mathematical operators that would be ideal. Of course, if anyone has a formula parser, that would work too.

    Many thanks for any help

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    use eval()

    eg:
    Code:
    <%@ Language=VBScript %>
    <html>
    <head>
    <body>
    <% dim strFormula 
    strFormula  = "26*32"
    
    response.write strFormula & "= " & eval(strFormula)
    %>
    </body>
    </html>
    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width