Programación Web y Scripting > ASP

 Re: Problemas Con SQL y ASP

(1/1)

KidD:

--- Citar ---Mensaje original de KidD
Mi probelma es que me tira error cuando quiero ejecutar la sentencia SQL en la pagina de borrar

Me tira este error
Tipo de error:
Microsoft JET Database Engine (0x80004005)
No se pudo eliminar nada en las tablas especificadas.
/borrar.asp, línea 20

Lei por ahi que podia ser algo de permisos de escritura pero busque cambie varios permisos(quizas hice alguna cagada)
y sigue sin funcionar
ALguien me peude ayudar?

Esta es la pagina que lista

 
--- Código: Text --- <% @Language=VBScript%><% Option Explicit %><%Dim ObjConnDim ObjRSDim SQL%><html> <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><meta name="ProgId" content="FrontPage.Editor.Document"><title>Pagina nueva 1</title></head> <body>  <%SQL = "SELECT * FROM prueba"Set ObjConn = Server.CreateObject("ADODB.Connection")Set ObjRS = Server.CreateObject("ADODB.RecordSet")ObjConn.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("prueba.mdb"))  ObjRS.Open SQL, ObjConn, 3, 3%><form method="POST" action="borrar.asp"><table border="1" cellpadding="0" cellspacing="0" width="100%" bordercolor="#464646" style="font-family: Verdana; font-size: 8 pt"><TR>        <td width="6%" bgcolor="#CCCCCC" style="font-weight: bold" align="center"> </TD>        <td width="3%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">ID</TD>        <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Nombre</TD>        <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Apellido</TD>        <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">DNI</TD>        <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">E-Mail</TD>        <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Usuario</TD>             <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Contraseña</TD></TR> <%Do While NOT ObjRS.EOF%>        <TR>        <td width="69%" bgcolor="#EEEEEE" colspan="8"></TD>    </TR>    <TR>        <TD width="6%" bgcolor="#EEEEEE" align="center">             <p><input type="checkbox" name="<%=ObjRS("id")%>" value="ON"></p>           </TD>        <td width="3%" bgcolor="#EEEEEE" style="font-weight: bold" align="center"><%=ObjRS("id")%></TD>        <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("nombre")%></TD>        <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("apellido")%></TD>        <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("dni")%></TD>        <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("email")%></TD>        <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("usuario")%></TD>        <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("contraseña")%></TD>    </TR>    <%ObjRS.MoveNext%> <%LoopObjRS.CloseObjConn.CloseSet ObjRS = NothingSet ObjConn = Nothing%>    <TR>        <td width="69%" bgcolor="#EEEEEE" colspan="8"></TD>    </TR>        <TR>        <td width="69%" bgcolor="#EEEEEE" colspan="8" align="center"><input type="submit" value="Borrar"></TD>        </td>    </TR></TB></table></form></body>  

Este es la pagina que borra
 
--- Código: Text --- <%@ Language = VBScript%><%OPTION EXPLICIT%><%Dim ObjConnDim ObjRSDim SQLSentenceDim elementos SQLSentence = "DELETE * FROM prueba WHERE "SET ObjConn = Server.CreateObject("ADODB.Connection")SET ObjRS = Server.CreateObject("ADODB.RecordSet")ObjConn.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("prueba.mdb")) for elementos = 1 to Request.Form.Count    if Request.Form(elementos) = "ON" then        SQLSentence = SQLSentence & "id=" & elementos & " OR "    end ifnextSQLSentence = left(SQLSentence,Len(SQLsentence)-3)ObjConn.Execute SQLSentenceResponse.Redirect ("lista.asp")%>  
Muchas gracias. KidD </b>
--- Fin de la cita ---
 

el campo id en la base de datos (acces) es autonumérico

KidD:
Buen ya me explico un amigo como se hace esto lo ue tenia que hacer es ir a la carpeta donde se ecneuntra la abse de datos. herramientas>opciones de carp ver>y destildar la opcion de utilizar uso compartido simple de archivos (WinXP).
Luego ir a las propiedades de la base de datos y en la solpa de seguridad poner los permisos de ejecucion escritura y modificacion o los que se necesiten al usuario que sea necesario.

Saludos y espero que les sea util. Hoy he aprendido una csa nueva:P

Navegación

[0] Índice de Mensajes

Ir a la versión completa