Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/02/2004, 10:17
Avatar de PMP
PMP
 
Fecha de Ingreso: febrero-2003
Ubicación: Chacabuco - Buenos Aires
Mensajes: 214
Antigüedad: 22 años, 2 meses
Puntos: 1
Cuántas consultas debes hacer?
Yo cuando tengo que comprobar si un registro existe y si no existe crearlo, utilizo lo siguiente:

<%
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = "DSN"
rs.Source = "SELECT tabla.* FROM tabla WHERE id = " & varID
rs.CursorType = 1
rs.LockType = 3
rs.Open

if rs.BOF AND rs.EOF then
rs.AddNew
end if

rs("campo1") = Request.Form("txtCampo1")
rs("campo2") = Request.Form("txtCampo2")
rs.Update

rs.Close
Set rs = Nothing
%>


De esta forma solo abro una sola ves el recodrset.
Se entiende?

Saludos y espero te sirva de algo.