If statment doesn't work, why ?

  • Thread starter Carlos Fernandes
  • Start date
C

Carlos Fernandes

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

(e-mail address removed)
 
E

Evertjan.

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,186
Latest member
vinaykumar_nevatia

Latest Threads

Top