Hi,
I'm using ADO 2.6 from within VFP6 SP5 and am having a problem getting a record set to be returned from an ADO command object when executing a stored procedure on SQL Server 7. Here is my code:
loConn = createobject("ADODB.Connection")
loConn.Open(lcConnStr)
loCmd = CreateObject("ADODB.Command")
with loCmd
.ActiveConnection = loConn
.CommandType = 4 && Stored Procedure
.CommandText = 'sp_getkey'
.Parameters('@tablename').Value = 'CUSTOMERS'
loRS = .Execute
endwith
? loRS.State && This displays 0, closed.
This stored procedure is used to generate primary keys. It increments the counter in the keymaster table for a specific table and returns a single row and column with the next available key. When I run the above code, the keymaster table get incremented fine, so I know the stored procedure is running. However, the record set (loRS) does not contain my selected row from the stored procedure. As a matter of fact, it is closed. I can call this same stored procedure using SQL Pass Thru and it returns a cursor fine. I would really like to get this to work using ADO. If someone can let me know what I might be missing, I would greatly appreciate it.
Thanks,
James