• Domingo 19 de Mayo de 2024, 17:52

Autor Tema:  Re: Problemas Con SQL y ASP  (Leído 4988 veces)

KidD

  • Nuevo Miembro
  • *
  • Mensajes: 20
    • Ver Perfil
Re: Problemas Con SQL y ASP
« en: Miércoles 12 de Noviembre de 2003, 21:04 »
0
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
  1.  
  2. <% @Language=VBScript%>
  3. <% Option Explicit %>
  4. <%
  5. Dim ObjConn
  6. Dim ObjRS
  7. Dim SQL
  8. %>
  9. <html>
  10.  
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  13. <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
  14. <meta name="ProgId" content="FrontPage.Editor.Document">
  15. <title>Pagina nueva 1</title>
  16. </head>
  17.  
  18. <body>
  19.  
  20.  
  21. <%
  22. SQL = "SELECT * FROM prueba"
  23. Set ObjConn = Server.CreateObject("ADODB.Connection")
  24. Set ObjRS = Server.CreateObject("ADODB.RecordSet")
  25. ObjConn.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("prueba.mdb"))
  26.  
  27.  
  28. ObjRS.Open SQL, ObjConn, 3, 3%>
  29. <form method="POST" action="borrar.asp">
  30. <table border="1" cellpadding="0" cellspacing="0" width="100%" bordercolor="#464646" style="font-family: Verdana; font-size: 8 pt">
  31. <TR>
  32.         <td width="6%" bgcolor="#CCCCCC" style="font-weight: bold" align="center"> </TD>
  33.         <td width="3%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">ID</TD>
  34.         <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Nombre</TD>
  35.         <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Apellido</TD>
  36.         <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">DNI</TD>
  37.         <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">E-Mail</TD>
  38.         <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Usuario</TD>    
  39.         <td width="11%" bgcolor="#CCCCCC" style="font-weight: bold" align="center">Contraseña</TD>
  40. </TR>
  41.  
  42. <%Do While NOT ObjRS.EOF%>
  43.    
  44.     <TR>
  45.         <td width="69%" bgcolor="#EEEEEE" colspan="8"></TD>
  46.     </TR>
  47.     <TR>
  48.         <TD width="6%" bgcolor="#EEEEEE" align="center">
  49.             <p><input type="checkbox" name="<%=ObjRS("id")%>" value="ON"></p>  
  50.         </TD>
  51.         <td width="3%" bgcolor="#EEEEEE" style="font-weight: bold" align="center"><%=ObjRS("id")%></TD>
  52.         <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("nombre")%></TD>
  53.         <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("apellido")%></TD>
  54.         <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("dni")%></TD>
  55.         <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("email")%></TD>
  56.         <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("usuario")%></TD>
  57.         <td width="10%" bgcolor="#EEEEEE" align="center"><%=ObjRS("contraseña")%></TD>
  58.     </TR>
  59.     <%ObjRS.MoveNext%>
  60.  
  61. <%
  62. Loop
  63. ObjRS.Close
  64. ObjConn.Close
  65. Set ObjRS = Nothing
  66. Set ObjConn = Nothing
  67. %>
  68.     <TR>
  69.         <td width="69%" bgcolor="#EEEEEE" colspan="8"></TD>
  70.     </TR>
  71.    
  72.     <TR>
  73.         <td width="69%" bgcolor="#EEEEEE" colspan="8" align="center"><input type="submit" value="Borrar"></TD>
  74.         </td>
  75.     </TR>
  76. </TB>
  77. </table>
  78. </form>
  79. </body>
  80.  
  81.  


Este es la pagina que borra
 
Código: Text
  1.  
  2. <%@ Language = VBScript%>
  3. <%OPTION EXPLICIT%>
  4. <%
  5. Dim ObjConn
  6. Dim ObjRS
  7. Dim SQLSentence
  8. Dim elementos
  9.  
  10. SQLSentence = "DELETE * FROM prueba WHERE "
  11. SET ObjConn = Server.CreateObject("ADODB.Connection")
  12. SET ObjRS = Server.CreateObject("ADODB.RecordSet")
  13. ObjConn.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("prueba.mdb"))
  14.  
  15. for elementos = 1 to Request.Form.Count
  16.     if Request.Form(elementos) = "ON" then
  17.         SQLSentence = SQLSentence & "id=" & elementos & " OR "
  18.     end if
  19. next
  20. SQLSentence = left(SQLSentence,Len(SQLsentence)-3)
  21. ObjConn.Execute SQLSentence
  22. Response.Redirect ("lista.asp")
  23. %>
  24.  
  25.  

Muchas gracias. KidD </b>
 

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

KidD

  • Nuevo Miembro
  • *
  • Mensajes: 20
    • Ver Perfil
Problemas Con SQL y ASP
« Respuesta #1 en: Jueves 13 de Noviembre de 2003, 01:53 »
0
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