If statment doesn't work, why ?

Discussion in 'ASP General' started by Carlos Fernandes, May 1, 2004.

  1. Why when i awsner N in my if statment it also inserts data in my db ?

    insere.asp

    <%
    ....asp code...
    %>
    <SCRIPT LANGUAGE=VBScript>
    nr=inputbox("S/N." )
    if ucase(nr)="S" then
    document.write "<%Set RS = Server.CreateObject ("ADODB.Recordset")%>"
    document.write "<%RS.Open "reuniao", DB, 1,2 %>"
    document.write "<%RS.AddNew%>"
    document.write "<%RS ("solicitante") = request.form("solicitante")%>"
    document.write "<%RS.Update%>" document.write "<%response.write
    "Inserted"%>"
    else
    window.history.back()
    end if
    </SCRIPT>
    <%
    ....asp code...
    %>

    Best regards,

    Carlos

     
    Carlos Fernandes, May 1, 2004
    #1
    1. Advertising

  2. Carlos Fernandes

    Evertjan. Guest

    Carlos Fernandes wrote on 01 mei 2004 in
    microsoft.public.inetserver.asp.general:

    > Why when i awsner N in my if statment it also inserts data in my db ?
    >


    ASP code is executed serverside BEFORE the page is sent to the client.
    The client cannot execute ASP code.

    > document.write "<%Set RS = Server.CreateObject ("ADODB.Recordset")%>"


    The <% ... %> is executed [serverside, see above], but gives no string in

    document.write ""

    So it is not a very logical thing to do.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., May 1, 2004
    #2
    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. JL

    Return statment

    JL, Dec 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    395
    Hermit Dave
    Dec 17, 2003
  2. crjunk
    Replies:
    2
    Views:
    1,589
    crjunk
    Sep 3, 2004
  3. Luk
    Replies:
    2
    Views:
    310
    Andrew Thompson
    Feb 10, 2004
  4. Bill Sneddon
    Replies:
    2
    Views:
    1,201
    Bill Sneddon
    Jun 28, 2003
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,030
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page