ese error ya lo arregele...ahora me dice esto al enviar el form a detalle.asp
Tipo de error:
Error de Microsoft VBScript en tiempo de ejecución (0x800A000D)
No coinciden los tipos
/tablero/detalles.asp, línea 20
el tema es que me actualiza los registros pero me modifica todos los valores BME de la tabla SQL.
aqui el codigo exacto que uso
Código:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim cnn, rs, SQL
set cnn=Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset")
cnn.open "circulacion", "sa", ""
' Borrado / busqueda para actualizar
if request.QueryString("borrar") <> "" then
cnn.execute("DELETE FROM costos_maxirest WHERE bme = " & request.QueryString("borrar"))
elseif request.QueryString("update") <> "" then
set rs = cnn.execute("SELECT * FROM costos_maxirest WHERE bme = " & request.QueryString("update"))
end if
' Insercion / modificacion de registros
if request.Form("bme") <> "" then
if request.Form("action") = "update" then
set sql = cnn.execute("UPDATE costos_maxirest SET bme = " & request.Form("bme")) & "'"
sql = sql & " WHERE bme = " & request.Form("bme") ' Actualizar
else
' Comprobamos que no exista
Dim rsd
set rsd = Server.CreateObject("ADODB.Recordset")
set rsd = cnn.execute("SELECT bme FROM costos_maxirest WHERE bme = " & request.Form("bme"))
existe = not rsd.EOF
rsd.close()
if not existe then
sql = "INSERT INTO costos_maxirest (bme) VALUES ("
sql = sql & ",'" & request.Form("bme") & "'"
end if
end if
end if
' Lo ideal es que controles el SQL injection
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="detalles.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Fecha</td>
<td><p><% if isObject(rs) then response.Write(rs.fields("fecha").value)%></p></td>
</tr>
<tr>
<td>bme</td>
<td><p>
<input type="text" name="bme" value="<% if isObject(rs) then response.Write(rs.fields("bme").value)%>" />
</p> </td>
</tr>
<tr>
</tr>
<tr>
<td colspan="2" align="center">
<input type="hidden" name="action" value="<% if isObject(rs) then response.Write("update") else response.Write("insert") %>" />
<input type="submit" name="Submit" value="Enviar" /></td>
</tr>
</table>
</form>
</body>
</html>
gracias
tammander