Its late and I have forgotten how to pass params to SQL Server SP from VFP
Everything I try returns -1
My connection is fine
I have tried variations on the following
tn=SQLCONNECT('dataprot')
? SQLEXEC(tn, 'exec #sp_udepartment 0,"test"')
v1=0
v2="test"
? SQLEXEC(tn, 'exec #sp_udepartment v1,v2')
and also
? SQLEXEC(tn, 'exec #sp_udepartment @v1,@v2')
Here is the SP I am trying to call. There is a chance I have the SP wrong since I am still a novice with SQL Server.
CREATE PROCEDURE sp_uDepartment
@deptid int,
@deptname varchar(10)
AS
SET NOCOUNT ON
SET XACT_ABORT ON
BEGIN TRANSACTION
IF (@deptid = 0 OR @deptid IS NULL)
BEGIN
-- Insert Values into the Department table
INSERT Department
(deptname)
SELECT @deptname
SELECT @deptid = SCOPE_IDENTITY()
END
ELSE
BEGIN
-- Update the Department table
UPDATE Department
SET deptname = ISNULL(@deptname, deptname)
WHERE deptid = @deptid
END
GO