Problems with script in ASP page

Discussion in 'ASP General' started by Indiana, Nov 9, 2005.

  1. Indiana

    Indiana Guest

    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\;Collating 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
    %>
     
    Indiana, Nov 9, 2005
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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\;Collating 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
    > %>
     
    Ray Costanzo [MVP], Nov 9, 2005
    #2
    1. Advertising

  3. Indiana

    Indiana Guest

    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" <> wrote in message
    > news:...
    > > 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\;Collating 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
    > > %>

    >
    >
    >
     
    Indiana, Nov 10, 2005
    #3
  4. 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" <> wrote in message
    news:D...
    > 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" <> wrote in message
    >> news:...
    >> > 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\;Collating
    >> > 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
    >> > %>

    >>
    >>
    >>
     
    Ray Costanzo [MVP], Nov 10, 2005
    #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. Eric
    Replies:
    0
    Views:
    587
  2. Rajat
    Replies:
    3
    Views:
    747
    Jorgen Grahn
    Jan 8, 2010
  3. VYAS ASHISH M-NTB837
    Replies:
    2
    Views:
    602
    Jan Kaliszewski
    Jan 7, 2010
  4. Robert Cohen
    Replies:
    3
    Views:
    306
    Andrew Durstewitz
    Jul 15, 2003
  5. Simon Wigzell

    Calling an asp script from an asp script

    Simon Wigzell, May 8, 2004, in forum: ASP General
    Replies:
    4
    Views:
    183
    Lance Wynn
    May 10, 2004
Loading...

Share This Page