registros de una tabla.
ahora bien , todo funciona ala perfeccion excepto que si yo modifico un registro
y lo vuelvo a consultar en la misma pantalla no me despliega el valor modificado.
les pongo un ejemplo:
en mi tabla tengo 2 campos(id, nombre)
en el onblur del 1er input voy y buscoen la tabla, si esta dicho valor pues en
el 2do input lo despliego, pero loq ue hace ahorita es ponerme el valor anterior
al que yo ya modifique!! que puede estar pasando ???
les dejo mi codigo, espero que me ayuden a encontrar la falla, gracias!!!
Código:
<!-- #include file="../conexion.asp"--> <% Dim id_grupo, nombre, Metodform, funcion, rs id_grupo = request.Form("grupoid") nombre = request.Form("nombre") Metodform = request.servervariables("REQUEST_METHOD") funcion = request.Form("metodo") function grabar(id_grupo,nombre) call conectarDB sSQL = "Select * From DS_Grupos where grupos_id = "& id_grupo Set rs = cnn.Execute(sSQL) if rs.eof then sSQL = "Insert into DS_Grupos(grupos_id, grupos_nombre) VALUES ('"& id_grupo &"','"& nombre &"')" cnn.Execute(sSQL) Nombre = "" end if rs.close Set rs = nothing call desconectarDB end function function eliminar(id_grupo,nombre) call conectarDB sSQL = "Select * From DS_Grupos where grupos_id = "& id_grupo Set rs = cnn.Execute(sSQL) if not rs.eof then sSQL = "DELETE from DS_Grupos where grupos_id = "& id_grupo cnn.Execute(sSQL) Nombre = "" end if rs.close Set rs = nothing call desconectarDB end function function actualizar(id_grupo,nombre) call conectarDB sSQL = "Select * From DS_Grupos where grupos_id = "& id_grupo Set rs = cnn.Execute(sSQL) if not rs.eof then sSQL = "UPDATE DS_Grupos SET grupos_nombre = '"& nombre &"' where grupos_id = "& id_grupo cnn.Execute(sSQL) Nombre = "" end if rs.close Set rs = nothing call desconectarDB end function if Metodform = "POST" then select case funcion case "Guardar" call grabar(id_grupo,nombre) case "Borrar" call eliminar(id_grupo,nombre) case "Modificar" call actualizar(id_grupo,nombre) end select end if %>
formulario dentro de <html><body>...</body></html>
Código:
<input name="grupoid" id="grupoid" type="text" value="<%=idGrupo%>" size="20" maxlength="20" onblur="Buscar(this.id)" /> </td><td><input name="ver" type="image" id="ver" value="submit" src="Images/20_VER1.jpg" onclick="window.open('consultasistema.asp','','width=600,height=500,status=yes,toolbar=no,menubar=no,location=no,scrollbar=yes'); return false;" /></td> </tr></table></td></tr> <tr><td> <br />Nombre del grupo: <br /><span class="dtobligatorio"> * </span> <input name="nombre" type="text" id="nombre" value="<%=Nombre%>" size="70" maxlength="30" /> </td> </tr> <tr><td><br /><br /></td></tr> <tr><td> <table align="left"> <tr> <td width="167" height="36"> <input name="Guardar" type="image" value="submit" id="Guardar" src="images/GUARDAR1.gif" style=" visibility: hidden;" onclick="Metodos(this.id)" /></td> <td width="167" height="36"> <input name="Modificar" type="image" value="submit" id="Modificar" src="images/modificar1.gif" style=" visibility: hidden;" onclick="Metodos(this.id)" /></td> <td width="159"> <input name="Borrar" type="image" value="submit" id="Borrar" src="Images/ELIMINAR1.gif" style=" visibility: hidden;" onclick="Metodos(this.id)" /></td> <td width="72"> <input name="Imprimir" type="image" value="submit" id="Imprimir" src="images/IMPRIMIR1.gif" style=" visibility: hidden;" onclick="Imprimir(this.id)" /></td> </tr> <input type="hidden" id="metodo" name="metodo" /> </table> </td></tr> <tr><td class="dtobligatorio"><br /><br />(*) Datos obligatorios </td></tr> </table> </form>