ASP Serverside/client interaction

R

Rationalman

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
 
A

Aaron Bertrand [MVP]

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?
 
R

Rationalman

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
 
A

Aaron Bertrand [MVP]

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top