Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

razs

viabilidade de script

Recommended Posts

Pessoal, acham que isto pode dar problemas??

 

 

<%
xppa="select * from cert"
rs.open xppa,conn,2,2	

sub verif1
if request.form("data1")="" or request.form("data2")="" or request.form("item1_1")="" or request.form("item1_2")="" or request.form("item1_3")="" or request.form("item2_1")="" or request.form("item2_2")="" or request.form("item2_2")="" or request.form("read")="" or request.form("ficheirosss")="" then
response.Write("<script>alert('All fields mark with * are mandatory!');location.href='javascript:history.go(0)'</script>")
end if
end sub

sub verif
if request.form("eq_model")="" or request.form("eq_serial")="" or request.form("eq_soft")="" or request.form("eq_resolution")="" or request.form("specify")="" or request.form("ficheirosss")="" then
response.Write("<script>alert('All fields mark with * are mandatory!');location.href='javascript:history.go(0)'</script>")
end if
end sub

if request.form("insform_eq_cfp.x")>0 then
call verif
rs.addnew
rs.fields("exam")="CFP Equipment Certification"
call alert1	
end if

if request.form("insform_eq_oct.x")>0 then
call verif
rs.addnew
rs.fields("exam")="OCT Equipment Certification"
call alert1	
end if

if request.form("insform_eq_mferg.x")>0 then
call verif
rs.addnew
rs.fields("exam")="mfERG Equipment Certification"
call alert1
end if

if request.form("insform_eq_cfp_re.x")>0 then
call verif
rs.addnew
rs.fields("exam")="CFP Equipment Recertification"
call alert1	
end if

if request.form("insform_eq_oct_re.x")>0 then
call verif
rs.addnew
rs.fields("exam")="OCT Equipment Recertification"
call alert1	
end if

if request.form("insform_eq_mferg_re.x")>0 then
call verif
rs.addnew
rs.fields("exam")="mfERG Equipment Recertification"
call alert1
end if

if request.form("insform_cfp.x")>0 then
call verif1
rs.addnew
rs.fields("exam")="CFP Photography Certification"
call alert	
end if

if request.form("insform_oct.x")>0 then
call verif1
rs.addnew
rs.fields("exam")="OCT Photography Certification"
call alert	
end if

if request.form("insform_mferg.x")>0 then
call verif1
rs.addnew
rs.fields("exam")="mfERG Photography Certification"
call alert
end if

if request.form("insform_cfp_re.x")>0 then
call verif1
rs.addnew
rs.fields("exam")="CFP Photography Recertification"
call alert	
end if

if request.form("insform_oct_re.x")>0 then
call verif1
rs.addnew
rs.fields("exam")="OCT Photography Recertification"
call alert	
end if

if request.form("insform_mferg_re.x")>0 then
call verif1
rs.addnew
rs.fields("exam")="mfERG Photography Recertification"
call alert
end if

sub alert
rs.fields("data1")=request.form("data1")
rs.fields("data2")=request.form("data2")
rs.fields("item1_1")=request.form("item1_1")
rs.fields("item1_2")=request.form("item1_2")
rs.fields("item1_3")=request.form("item1_3")
rs.fields("item2_1")=request.form("item2_1")
rs.fields("item2_2")=request.form("item2_2")
rs.fields("item2_3")=request.form("item2_2")
rs.fields("read")=request.form("read")
rs.fields("ficheirosss")=request.form("ficheirosss")
rs.fields("data_reg")=date()    
rs.fields("user")=Session("user")	
rs.update
rs.close
   conn.close
response.Write("<script>alert('Equipment entered sucessfully!!');location.href='javascript:history.go(-1)'</script>")
end sub


sub alert1
rs.fields("eq_model")=request.form("eq_model")
rs.fields("eq_serial")=request.form("eq_serial")
rs.fields("eq_soft")=request.form("eq_soft")
rs.fields("eq_resolution")=request.form("eq_resolution")
rs.fields("specify")=request.form("specify")
rs.fields("ficheirosss")=request.form("ficheirosss")
rs.fields("data_reg")=date()    
rs.fields("user")=Session("user")	
rs.update
rs.close
   conn.close
response.Write("<script>alert('Data entered sucessfully!!');location.href='javascript:history.go(-1)'</script>")
end sub
%>


Compartilhar este post


Link para o post
Compartilhar em outros sites

ao invés de usar o método AddNew e o Update do objeto recordset, utilze as instruções SQL compativeis, você terá um ganho de performance no code

Compartilhar este post


Link para o post
Compartilhar em outros sites

com instrucao compativel queres dizer um insert??

 

era isto?

 

<%
if request.form("insform_eq_cfp.x")>0 then
call verif
exam="CFP Equipment Certification"
call alert1	
end if
if request.form("insform_eq_oct.x")>0 then
call verif

exam="OCT Equipment Certification"
call alert1	
end if
if request.form("insform_eq_mferg.x")>0 then
call verif

exam="mfERG Equipment Certification"
call alert1
end if

if request.form("insform_eq_cfp_re.x")>0 then
call verif
exam="CFP Equipment Recertification"
call alert1	
end if

if request.form("insform_eq_oct_re.x")>0 then
call verif
exam="OCT Equipment Recertification"
call alert1	
end if

if request.form("insform_eq_mferg_re.x")>0 then
call verif
exam="mfERG Equipment Recertification"
call alert1
end if

if request.form("insform_cfp.x")>0 then
call verif1
exam="CFP Photography Certification"
call alert	
end if

if request.form("insform_oct.x")>0 then
call verif1
exam="OCT Photography Certification"
call alert	
end if

if request.form("insform_mferg.x")>0 then
call verif1
exam="mfERG Photography Certification"
call alert
end if

if request.form("insform_cfp_re.x")>0 then
call verif1
exam="CFP Photography Recertification"
call alert	
end if

if request.form("insform_oct_re.x")>0 then
call verif1
exam="OCT Photography Recertification"
call alert	
end if

if request.form("insform_mferg_re.x")>0 then
call verif1
exam="mfERG Photography Recertification"
call alert
end if

sub verif1
if request.form("read")="" or request.form("ficheirosss")="" then
response.Write("<script>alert('All fields mark with * are mandatory!');location.href='cert.asp'</script>")
end if
end sub

sub verif
if request.form("read")="" or request.form("ficheirosss")="" then
response.Write("<script>alert('All fields mark with * are mandatory!');location.href='cert.asp'</script>")
end if
end sub

sub alert
sql="INSERT INTO cert (data1, data2, item1_1,item1_2,item1_3,item2_1,exam,item2_2,item2_3, read,ficheirosss,data_reg,user) VALUES ("& request.form("data1")& ","& request.form("data2")& ","& request.form("item1_1")& ","& request.form("item1_2")& ","& request.form("item1_3")& ","& request.form("item2_1")& ","&exam& ","& request.form("item2_2")& ","& request.form("item2_3")& ","& request.form("read")& ","&request.form("ficheirosss")& ","& date()& ","& Session("user")&")"
response.Write("<script>alert('Equipment entered sucessfully!!');location.href='javascript:history.go(-1)'</script>")
end sub


sub alert1
sql="INSERT INTO cert (eq_model, eq_serial, eq_soft,eq_resolution,specify,read,ficheirosss,data_reg,user,exam) VALUES ("& request.form("eq_model")& ","& request.form("eq_serial")& ","& request.form("eq_soft")& ","& request.form("eq_resolution")& ","& request.form("specify")& ","& request.form("read")& ","&request.form("ficheirosss")& ","& date()& ","& Session("user")&","&exam&")"
response.Write("<script>alert('Data entered sucessfully!!');location.href='javascript:history.go(-1)'</script>")
end sub
%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

INSERT ou se precisar do UPDATE também

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.