ASP Serverside/client interaction

Discussion in 'ASP General' started by Rationalman, Nov 22, 2003.

  1. Rationalman

    Rationalman Guest

    I'm new to ASP, and need to do something that should be
    straightforward.

    I want to access the database in my vbscript function on the
    serverside, when someone clicks a button on the cient side. Originally
    in my local environment it worked, as I was using createobject for
    adodb (access database) in the
    docalc function. However, on the webserver apparently I need to use
    server.createobject, and that means running the function in the
    server.
    So how can that be done?

    My thinking is that I'd have to repost the entire form back to the
    same
    web page and set some variable to indicate to the server side that
    it's suppoesd to execute the database query and calculation. I've
    tried
    moving my function into the server code section and interrogating the
    variable but so far not returning html.

    I was hoping that I wouldn't have to post and redisplay all the
    fields.
    Is there a way around this? Can I just call a routine with the fields
    that I'm concerned about?

    I didn't want to belabour the details, so I'm hoping someone knows
    what I'm trying to do. I'd like to keep it simple, so any pointers
    appreciated.

    Thanks,


    Larry Knowles


    *** I see that my pages start with . . .

    <%@ Language=VBScript %>
    <% OPTION EXPLICIT %>

    <%

    *** THERE'S A BUNCH OF VARIABLES


    *** Then some code which runs on the server


    %>

    *** Then the HTML

    <html lang="<%=g_Language%>">
    <head>
    <title>Data Entry - <%=g_TableAlias%></title>

    ....

    *** There's a javascript in the html

    <script language="JavaScript" type="text/javascript">
    function doSubmit()
    end function

    </script>

    *** and a vb script (mine - no netscapers using the site)

    <script language="VBscript" type="text/vbscript" RUNAT=SERVER >
    Dim w
    Dim oPopBody

    Function doCalc

    end function

    </script

    *** then there's a whole bunch of html which is the form
    Rationalman, Nov 22, 2003
    #1
    1. Advertising

  2. > I want to access the database in my vbscript function on the
    > serverside, when someone clicks a button on the cient side.


    The client side can't see the server, until you make another request from
    the server.

    > docalc function. However, on the webserver apparently I need to use
    > server.createobject, and that means running the function in the
    > server.
    > So how can that be done?


    Submit a form?
    Aaron Bertrand [MVP], Nov 22, 2003
    #2
    1. Advertising

  3. Rationalman

    Rationalman Guest

    Thanks Aaron.

    Let me take a step back.

    I'm able to pull data from my local access database, running my
    local server, using createobject to start ado. It pulls data fine.
    I had to change my security settings to avoid a warning message.

    On the webserver, the regular queries which run on the serverside
    work fine. However, my query, using Server.CreateObject from
    the client side fails, and CreateObject from the client side fails
    too.

    When I try Createobject it indicates it's trying to access
    a database on another domain (error), so I changed IE permissions
    to allow that. Then it doesn't connect because of a missing "object".

    The datasource file name on the webserver is correct.

    Is querying a database from the client-side script permitted in ASP?
    Are thereany issues to be aware of?

    Thanks a lot!

    Larry
    Rationalman, Nov 22, 2003
    #3
  4. You can't connect to a server-side database from client-side code. You also
    can't connect to your client-side database from client-side code that runs
    on another web server.

    Why would you want your web site to access a database on your own machine?
    Put the database file on the web server, then you can access it from
    server-side script.

    If you really think you want to access a database from client-side script,
    please see microsoft.public.scripting.jscript

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Rationalman" <> wrote in message
    news:...
    > Thanks Aaron.
    >
    > Let me take a step back.
    >
    > I'm able to pull data from my local access database, running my
    > local server, using createobject to start ado. It pulls data fine.
    > I had to change my security settings to avoid a warning message.
    >
    > On the webserver, the regular queries which run on the serverside
    > work fine. However, my query, using Server.CreateObject from
    > the client side fails, and CreateObject from the client side fails
    > too.
    >
    > When I try Createobject it indicates it's trying to access
    > a database on another domain (error), so I changed IE permissions
    > to allow that. Then it doesn't connect because of a missing "object".
    >
    > The datasource file name on the webserver is correct.
    >
    > Is querying a database from the client-side script permitted in ASP?
    > Are thereany issues to be aware of?
    >
    > Thanks a lot!
    >
    > Larry
    Aaron Bertrand [MVP], Nov 22, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Tillotson
    Replies:
    2
    Views:
    418
    Chris Tillotson
    Nov 4, 2003
  2. csgraham74
    Replies:
    5
    Views:
    5,412
    csgraham74
    Jun 14, 2005
  3. Angel Of Death
    Replies:
    2
    Views:
    559
    Angel Of Death
    Oct 2, 2006
  4. Rotsey
    Replies:
    1
    Views:
    391
    Rotsey
    Dec 20, 2006
  5. =?Utf-8?B?UHJhc2hhbnQgQw==?=

    Client and Serverside Script

    =?Utf-8?B?UHJhc2hhbnQgQw==?=, Aug 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    279
    Eliyahu Goldin
    Aug 10, 2007
Loading...

Share This Page