Dear allDon't know if this is the right place to post because I'm not sure if FoxPro is at fault, the SQL Server ODBC driver, or my crappy code!I'm currently porting a FoxPro app over to SQL Server 2000, and am wanting to use stored procedures with CursorAdapters instead of inline SQL.However, for larger tables I'm having to pass in loads of parameters (one for each field) so some of my procedure calls run into 2500+ characters. The stored procedure is running okay, the data is getting inserted and everything appears to be working fine, but my output parameter (ie. the newly inserted PK) isn't being returned to FoxPro. When I run the stored proc in Query Analyzer, it all works perfectly and the PK is returned.In FoxPro, it works fine on shorter commands (say 20 fields). At first I thought it was the 256 char limit in Fox, but as every field is getting inserted correctly then I'm not so sure now.If I'm doing something totally and utterly stupid here then please let me know! I'm open to all suggestions because this has been driving me mad for days. Is there a better way to approach this?Now for some code!The SQL I'm using in FoxPro:EXECUTE dbo.Tillsp_InsertTillCashUp @PK_TillCashUpID=?@PK_TillCashUpID, @CashUpDateTime=?CashUpDateTime, @FK_REFCompanyID=?FK_REFCompanyID, @FK_REFTillID=?FK_REFTillID, @FK_CardUserIDOperator=?FK_CardUserIDOperator, @FK_REFUnitID=?FK_REFUnitID, @FreeAmount=?FreeAmount, @CardAmount=?CardAmount, @CashAmount=?CashAmount, @ChequeAmount=?ChequeAmount
... etc etc for all fieldsNote in FoxPro the line @PK_TillCashUpID=?@PK_TillCashUpID - the '?' means pass the contents of local field PK_TillCashUpID and the '@' means pass by reference, so it gets populated from the output parameter. This works if I'm only using, say, a dozen parameters.And my stored procedure:CREATE PROCEDURE dbo.Tillsp_InsertTillCashUp( @TMPUserID varchar(10) = NULL, @PK_TillCashUpID int = NULL OUTPUT, @timestamp timestamp = NULL, @CashUpDateTime datetime = NULL, @FK_REFCompanyID char(3) = NULL, @FK_REFTillID char(3) = NULL, @FK_CardUserIDOperator varchar(10) = NULL, @FK_REFUnitID varchar(8) = NULL, @FreeAmount money = NULL, @CardAmount money = NULL, @CashAmount money = NULL, @ChequeAmount money = NULL, etc)AS /* Generated by DEVsp_GenerateInsertCode */ SET NOCOUNT ON DECLARE @LastError int INSERT INTO dbo.TillCashUp ( CashUpDateTime, FK_REFCompanyID, FK_REFTillID, FK_CardUserIDOperator, FK_REFUnitID, FreeAmount, CardAmount, CashAmount, ChequeAmount, etc ) VALUES ( COALESCE(@CashUpDateTime, getdate()), @FK_REFCompanyID, @FK_REFTillID, @FK_CardUserIDOperator, @FK_REFUnitID, COALESCE(@FreeAmount, 0), COALESCE(@CardAmount, 0), COALESCE(@CashAmount, 0), COALESCE(@ChequeAmount, 0), etc ) SET @LastError = @@ERROR IF @LastError = 0 SET @PK_TillCashUpID = SCOPE_IDENTITY() ELSE SET @PK_TillCashUpID = 0 RETURN @LastErrorGO
The error I normally get is:"Connectivity error: Unable to retrieve specific error information. Driver is probably out of resources"Even though SQL itself doesn't seem to be reporting any errors.ThanksPete