Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Problems with script in ASP page

Reply
Thread Tools

Problems with script in ASP page

 
 
Indiana
Guest
Posts: n/a
 
      11-09-2005
Situation: in an ASP page i have created i read a table and i display an ID
from the table then i have a button and when i click on a run a new query and
then the window has to be closed. (This page is an example page made it to
specify my problem)
The problem: when i click the button the btnsave_onclick proc is executed
but if i insert the commands to open my table it is non completely executed.
If i leave only a msgbox("HELLO") and a window.close commands there are non
problem. If i insert all the rows to create a connection i don't see the
msgbox("HELLO"); another problem is that i have set some Application
variables in Global.ASA and normally i can read them from vbscript code buto
in this proc i can't read them. Where is my error ?
I put my asp page code.
Thanks in advance for help.

<script LANGUAGE="vbscript">
Sub btnsave_onclick

dbconn = CreateObject("ADODB.Connection")

' from here commands are not executed
'and variables are non read
dbconn.ConnectionString = "Provider=VFPOLEDB;Data
Source=c:\inetpub\wwwroot\acut\database\Aupd\;Coll ating Sequence=Machine"
dbconn.Open "",""
'dbConn.ConnectionString = Application(Aupd_connectionstring")
'dbconn.Open
Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")
SQLQuery= "Select * From Usrs"

msgbox("HELLO")

window.Close

End Sub
</script>

<%
cId = Request.QueryString("Id")

Set dbconn = Server.CreateObject("ADODB.Connection")
dbconn.ConnectionString =Application("Aupd_connectionstring")
dbconn.Open
Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")

SQLQuery= "SELECT Usrs.Id, Usrs.psw, Usrs.Cli, Usrs.Mail, Usrs.Tipo,
Usrs.Area, Usrs.Act " & _
"From Usrs " & _
"Where Id='" & cId & "' " & _
"order by Id"

Set RS=dbconn.Execute(SQLQuery)
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test</title>
</head>
<body>
<% Response.Write(Rs("Id"))%>
<p><STRONG><FONT face=Tahoma color=dimgray size="2">
<INPUT id=btnsave type=submit value="Conferma"></FONT></STRONG></p>
</body>
</html>
<%
dbconn.Close
Set RS=Nothing
%>
 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      11-09-2005
Application variables exist on the server. You're trying to access them
from the client and run client side database code. ASP is a server-side
technology.

Ray at work

"Indiana" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Situation: in an ASP page i have created i read a table and i display an
> ID
> from the table then i have a button and when i click on a run a new query
> and
> then the window has to be closed. (This page is an example page made it to
> specify my problem)
> The problem: when i click the button the btnsave_onclick proc is executed
> but if i insert the commands to open my table it is non completely
> executed.
> If i leave only a msgbox("HELLO") and a window.close commands there are
> non
> problem. If i insert all the rows to create a connection i don't see the
> msgbox("HELLO"); another problem is that i have set some Application
> variables in Global.ASA and normally i can read them from vbscript code
> buto
> in this proc i can't read them. Where is my error ?
> I put my asp page code.
> Thanks in advance for help.
>
> <script LANGUAGE="vbscript">
> Sub btnsave_onclick
>
> dbconn = CreateObject("ADODB.Connection")
>
> ' from here commands are not executed
> 'and variables are non read
> dbconn.ConnectionString = "Provider=VFPOLEDB;Data
> Source=c:\inetpub\wwwroot\acut\database\Aupd\;Coll ating Sequence=Machine"
> dbconn.Open "",""
> 'dbConn.ConnectionString = Application(Aupd_connectionstring")
> 'dbconn.Open
> Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")
> SQLQuery= "Select * From Usrs"
>
> msgbox("HELLO")
>
> window.Close
>
> End Sub
> </script>
>
> <%
> cId = Request.QueryString("Id")
>
> Set dbconn = Server.CreateObject("ADODB.Connection")
> dbconn.ConnectionString =Application("Aupd_connectionstring")
> dbconn.Open
> Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")
>
> SQLQuery= "SELECT Usrs.Id, Usrs.psw, Usrs.Cli, Usrs.Mail, Usrs.Tipo,
> Usrs.Area, Usrs.Act " & _
> "From Usrs " & _
> "Where Id='" & cId & "' " & _
> "order by Id"
>
> Set RS=dbconn.Execute(SQLQuery)
> %>
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
> <title>Test</title>
> </head>
> <body>
> <% Response.Write(Rs("Id"))%>
> <p><STRONG><FONT face=Tahoma color=dimgray size="2">
> <INPUT id=btnsave type=submit value="Conferma"></FONT></STRONG></p>
> </body>
> </html>
> <%
> dbconn.Close
> Set RS=Nothing
> %>



 
Reply With Quote
 
 
 
 
Indiana
Guest
Posts: n/a
 
      11-10-2005
Ok, but if i need to read these variables how can i read them. Is it correct
to use post data to server and use another asp page to save my data using
request to read objects' values.

Thanks for help...

"Ray Costanzo [MVP]" wrote:

> Application variables exist on the server. You're trying to access them
> from the client and run client side database code. ASP is a server-side
> technology.
>
> Ray at work
>
> "Indiana" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Situation: in an ASP page i have created i read a table and i display an
> > ID
> > from the table then i have a button and when i click on a run a new query
> > and
> > then the window has to be closed. (This page is an example page made it to
> > specify my problem)
> > The problem: when i click the button the btnsave_onclick proc is executed
> > but if i insert the commands to open my table it is non completely
> > executed.
> > If i leave only a msgbox("HELLO") and a window.close commands there are
> > non
> > problem. If i insert all the rows to create a connection i don't see the
> > msgbox("HELLO"); another problem is that i have set some Application
> > variables in Global.ASA and normally i can read them from vbscript code
> > buto
> > in this proc i can't read them. Where is my error ?
> > I put my asp page code.
> > Thanks in advance for help.
> >
> > <script LANGUAGE="vbscript">
> > Sub btnsave_onclick
> >
> > dbconn = CreateObject("ADODB.Connection")
> >
> > ' from here commands are not executed
> > 'and variables are non read
> > dbconn.ConnectionString = "Provider=VFPOLEDB;Data
> > Source=c:\inetpub\wwwroot\acut\database\Aupd\;Coll ating Sequence=Machine"
> > dbconn.Open "",""
> > 'dbConn.ConnectionString = Application(Aupd_connectionstring")
> > 'dbconn.Open
> > Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")
> > SQLQuery= "Select * From Usrs"
> >
> > msgbox("HELLO")
> >
> > window.Close
> >
> > End Sub
> > </script>
> >
> > <%
> > cId = Request.QueryString("Id")
> >
> > Set dbconn = Server.CreateObject("ADODB.Connection")
> > dbconn.ConnectionString =Application("Aupd_connectionstring")
> > dbconn.Open
> > Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")
> >
> > SQLQuery= "SELECT Usrs.Id, Usrs.psw, Usrs.Cli, Usrs.Mail, Usrs.Tipo,
> > Usrs.Area, Usrs.Act " & _
> > "From Usrs " & _
> > "Where Id='" & cId & "' " & _
> > "order by Id"
> >
> > Set RS=dbconn.Execute(SQLQuery)
> > %>
> >
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
> > <title>Test</title>
> > </head>
> > <body>
> > <% Response.Write(Rs("Id"))%>
> > <p><STRONG><FONT face=Tahoma color=dimgray size="2">
> > <INPUT id=btnsave type=submit value="Conferma"></FONT></STRONG></p>
> > </body>
> > </html>
> > <%
> > dbconn.Close
> > Set RS=Nothing
> > %>

>
>
>

 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      11-10-2005
Yes, make the form post, execute code on the server, and present the page
with the data you need.

Since you're just beginning, you may want to jump into ASP.Net instead of
the 20th century ASP. But if not, I suggest you read some ASP tutorials.
http://www.google.com/search?hl=en&q=asp+tutorials

Ray at work

"Indiana" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Ok, but if i need to read these variables how can i read them. Is it
> correct
> to use post data to server and use another asp page to save my data using
> request to read objects' values.
>
> Thanks for help...
>
> "Ray Costanzo [MVP]" wrote:
>
>> Application variables exist on the server. You're trying to access them
>> from the client and run client side database code. ASP is a server-side
>> technology.
>>
>> Ray at work
>>
>> "Indiana" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Situation: in an ASP page i have created i read a table and i display
>> > an
>> > ID
>> > from the table then i have a button and when i click on a run a new
>> > query
>> > and
>> > then the window has to be closed. (This page is an example page made it
>> > to
>> > specify my problem)
>> > The problem: when i click the button the btnsave_onclick proc is
>> > executed
>> > but if i insert the commands to open my table it is non completely
>> > executed.
>> > If i leave only a msgbox("HELLO") and a window.close commands there are
>> > non
>> > problem. If i insert all the rows to create a connection i don't see
>> > the
>> > msgbox("HELLO"); another problem is that i have set some Application
>> > variables in Global.ASA and normally i can read them from vbscript code
>> > buto
>> > in this proc i can't read them. Where is my error ?
>> > I put my asp page code.
>> > Thanks in advance for help.
>> >
>> > <script LANGUAGE="vbscript">
>> > Sub btnsave_onclick
>> >
>> > dbconn = CreateObject("ADODB.Connection")
>> >
>> > ' from here commands are not executed
>> > 'and variables are non read
>> > dbconn.ConnectionString = "Provider=VFPOLEDB;Data
>> > Source=c:\inetpub\wwwroot\acut\database\Aupd\;Coll ating
>> > Sequence=Machine"
>> > dbconn.Open "",""
>> > 'dbConn.ConnectionString = Application(Aupd_connectionstring")
>> > 'dbconn.Open
>> > Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")
>> > SQLQuery= "Select * From Usrs"
>> >
>> > msgbox("HELLO")
>> >
>> > window.Close
>> >
>> > End Sub
>> > </script>
>> >
>> > <%
>> > cId = Request.QueryString("Id")
>> >
>> > Set dbconn = Server.CreateObject("ADODB.Connection")
>> > dbconn.ConnectionString =Application("Aupd_connectionstring")
>> > dbconn.Open
>> > Application("dbconn_RuntimeUserName"),Application( "DbConn_RuntimePassword")
>> >
>> > SQLQuery= "SELECT Usrs.Id, Usrs.psw, Usrs.Cli, Usrs.Mail, Usrs.Tipo,
>> > Usrs.Area, Usrs.Act " & _
>> > "From Usrs " & _
>> > "Where Id='" & cId & "' " & _
>> > "order by Id"
>> >
>> > Set RS=dbconn.Execute(SQLQuery)
>> > %>
>> >
>> > <html>
>> > <head>
>> > <meta http-equiv="Content-Type" content="text/html;
>> > charset=windows-1252">
>> > <title>Test</title>
>> > </head>
>> > <body>
>> > <% Response.Write(Rs("Id"))%>
>> > <p><STRONG><FONT face=Tahoma color=dimgray size="2">
>> > <INPUT id=btnsave type=submit value="Conferma"></FONT></STRONG></p>
>> > </body>
>> > </html>
>> > <%
>> > dbconn.Close
>> > Set RS=Nothing
>> > %>

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute a script from another script and other script does notdo busy wait. Rajat Python 3 01-08-2010 02:05 PM
RE: How to execute a script from another script and other script doesnotdo busy wait. VYAS ASHISH M-NTB837 Python 2 01-07-2010 08:18 PM
Where to put page specific script in a page that inherits from a master page? Eric ASP .Net 0 04-24-2006 11:54 PM
Calling an asp script from an asp script Simon Wigzell ASP General 4 05-10-2004 03:32 AM
Passing value from one script on one page to another script on another page. Robert Cohen ASP General 3 07-15-2003 01:46 PM



Advertisments