ASP Serverside/client interaction

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rationalman

    ASP Serverside/client interaction

    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.createob ject, 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=VBScri pt %>
    <% OPTION EXPLICIT %>

    <%

    *** THERE'S A BUNCH OF VARIABLES


    *** Then some code which runs on the server


    %>

    *** Then the HTML

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

    ....

    *** There's a javascript in the html

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

    </script>

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

    <script language="VBscr ipt" 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
  • Aaron Bertrand [MVP]

    #2
    Re: ASP Serverside/client interaction

    > I want to access the database in my vbscript function on the[color=blue]
    > serverside, when someone clicks a button on the cient side.[/color]

    The client side can't see the server, until you make another request from
    the server.
    [color=blue]
    > docalc function. However, on the webserver apparently I need to use
    > server.createob ject, and that means running the function in the
    > server.
    > So how can that be done?[/color]

    Submit a form?


    Comment

    • Rationalman

      #3
      Re: ASP Serverside/client interaction

      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.CreateOb ject 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

      Comment

      • Aaron Bertrand [MVP]

        #4
        Re: ASP Serverside/client interaction

        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.publi c.scripting.jsc ript

        --
        Aaron Bertrand
        SQL Server MVP
        This is a default index page for a new domain.





        "Rationalma n" <larry_know@yah oo.com> wrote in message
        news:45508c59.0 311221324.54df3 cb7@posting.goo gle.com...[color=blue]
        > 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.CreateOb ject 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[/color]


        Comment

        Working...