Ejecutar un procedimiento almacenado de SQL Server desde Fox 2.6
Visual Fox Pro, Trucos Comentarios ( 0 ) »Set Library To Sys(2004)+"fpsql.fll"
Public errval, errmsg, handle
errval=0
errmsg=" "
SourceName= "test"
User=
"sa"
passwd=""
* Conexión
handle=DBConnect(SourceName,User,passwd)
If handle > 0
Wait Window
"Conectado" Nowait
Else
Err=DBError(0,@errmsg,@errval)
Wait Window Str(errval)+" "+errmsg
Endif
=DBSetOpt(handle,"Asynchronous",0)
=DBSetOpt(handle,"BatchMode",1)
=DBSetOpt(handle,"ConnTimeout",0)
=DBSetOpt(handle,"Transact",1)
=DBSetOpt(handle,"UseTable",0)
err=DBExec(handle,"use pubs")
If Err < 0
=MessageBox("Error")
Return .F.
EndIf
SqlCmd= "Execute ConsultarOrden '25'"
err=DBExec(handle,SqlCmd)
If err > 0
Browse
Else
=MessageBox("Error")
Return .F.
Endif
*Desconexión
err=DBDisconn(handle)
Por: David Amador T