<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> Creacion de encuestas <% Const adOpenForwardOnly = 0 Const adOpenKeyset = 1 Const adOpenDynamic = 2 Const adOpenStatic = 3 Const adLockReadOnly = 1 Const adLockPessimistic = 2 Const adLockOptimistic = 3 Const adLockBatchOptimistic = 4 dbfile=Server.MapPath("datos/Tencuestas.mdb") Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&dbfile 'Set Conn = Server.CreateObject("ADODB.Connection") 'Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/datos/Tencuestas.mdb")) set rs=createobject("ADODB.Recordset") if request.form("activar")="ON" then fin=month(date)&"/"&day(date)&"/"&year(date) sqltxt="update encuestas set fin=#"&fin&"# where activa=True" 'response.write sqltxt conn.execute sqltxt sqltxt="update encuestas set activa=False where activa=True" conn.execute sqltxt end if sqltxt="select * from clave" rs.open sqltxt,conn if rs("clave")<> request.form("clave") then rs.close %>

Clave ERRONEA

Intentalo de nuevo

<%else rs.close pregunta=trim(request.form("pregunta")) tr1=trim(request.form("tr1")) tr2=trim(request.form("tr2")) tr3=trim(request.form("tr3")) tr4=trim(request.form("tr4")) if request.form("activar")="ON" then activar=True else activar=false end if if tr1="" or tr2="" or pregunta="" then%>

Al menos se deben ofrecer una pregunta y las alternativas 1 y 2

Intentalo de nuevo

<% else nopciones=2 rs.CursorType = adOpenKeyset rs.LockType = adLockOptimistic rs.open "encuestas",conn rs.addnew rs("pregunta")=pregunta rs("tr1")=tr1 rs("r1")=0 rs("tr2")=tr2 rs("r2")=0 if tr3 <> "" then nopciones=3 rs("tr3")=tr3 rs("r3")=0 if tr4 <> "" then nopciones=4 rs("tr4")=tr4 rs("r4")=0 end if end if rs("nopciones")=nopciones rs("activa")=activar if request.form("activar")="ON" then rs("inicio")=date end if rs.update%>

Nueva Encuesta creada


Identificador  <%=rs("idencuesta")%>
Pregunta <%=rs("pregunta")%>
Opción 1 <%=rs("tr1")%>
Opción 2 <%=rs("tr2")%>
Opción 3 <%=rs("tr3")%>
Opción 4 <%=rs("tr4")%>
Activacion <%=activar%>

<%rs.close conn.close end if end if%>