Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/01/2008, 22:48
Avatar de eeyore
eeyore
 
Fecha de Ingreso: mayo-2006
Mensajes: 53
Antigüedad: 19 años
Puntos: 0
Pregunta Ayuda con llamada a Procedimiento Almacenado

Hola muchachos tengo un problema con una llamada a un Procedimiento Almacenado, ojala me puedan ayudar a resolver mi problema. Estoy trabajando con asp y sql server 2000.

Este es el asp donde se ingresan los datos:

Código PHP:
<form name="forma" action="pruebaSP.asp" method="post">
    <
table width="80%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <
tr
            <
td height="73" align="right">
                <
div align="right"><font color="#999999" ><b>Prueba de Insert en SP&nbsp; &nbsp;</b></font><img src="http://www.forosdelweb.com/images/p1.gif" width="56" height="61" align="absmiddle">
            </
td>
        </
tr>
        <
tr>
          <
td>
                <
table>
                    <
tr>
                        <
td height="15" bgcolor="98BEE2" ><div align="center">Número de Operacion:</div></td>
                        <
td  height="15"  class="formaCampo"> <div align="center">
                          <
input size="50" type="text" maxlength="50" name="op" value="">
                      </
div></td>
                    </
tr>
                    <
tr>
                        <
td height="15" bgcolor="98BEE2" > <div align="center">Número de Cuenta:</div></td>
                        <
td class="formaCampo" height="15"> <div align="center">
                          <
input size="50" type="text" maxlength="50" name="cuenta" value="">
                      </
div></td>
                    </
tr>
                </
table>
            </
td>
        </
tr>
    </
table>
    <
br>
    <
div align="right">
        <
input type="submit" value="Insert SP">
    </
div>
</
form
Este es el codigo del archivo que recibe el anterior formulario, consigue los valores, creo la conexion y mando llamar el SP:

Código PHP:
<tr
    <
td height="21" colspan="2" align="center">
    <!---------------------------------->
    <%
    
op request.Form("op")
    
cuenta request.Form("cuenta")
    
    
response.Write("Operacion: "&op&"<br>")
    
response.Write("Cuenta: "&cuenta&"<br>")
    
        
Creo la conexion
    Set Conn 
Server.CreateObject("ADODB.Connection")
    
Conn.Open "ejemplo"
    
    
sql "Execute procedure InsertaEjemplo("&op&","&cuenta&")"
    
response.Write("sql SP: "&sql&"<br><br>")
    
Set busq Conn.execute(sql)
    
    if 
Not busq.eof Then
        response
.Write("SI PROCEDE")
    else
        
Conn.close
        set Conn 
Nothing
        response
.Write("NO PROCEDE")
    
end if
    %>
    <!-- 
AQUI VA EL CONTENIDO -->
    </
td>
</
tr
Y este es el SP que mando llamar:

Código PHP:
CREATE PROCEDURE InsertaEjemplo

@numOp int,

@
numCuenta int

AS

INSERT INTO movimientos(operacion,cvecuentaVALUES(@numOp, @numCuenta)

RETURN @@
IDENTITY
GO 
Me marca el siguiente error:

Microsoft OLE DB Provider for SQL Server error '80040e14'

Sintaxis incorrecta cerca de la palabra clave 'procedure'.


en esta la linea que hago la llamada al SP:

Set busq = Conn.execute(sql)

al ejecutar la siguiente linea:

Execute procedure InsertaEjemplo(15,25)

No se que estoy haciendo mal, agradezco su ayuda.

Última edición por eeyore; 01/01/2008 a las 22:50 Razón: error de redacion