Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Arggh Newbie can not get SP value back to VFP
Message
 
 
À
09/10/2003 10:48:26
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00836870
Message ID:
00836897
Vues:
17
Mark,

It's hard to help you when you keep creating new threads instead of continuing discussion. As I explained to you in the Message #836794 only integers can be used in RETURN statement. You can return a value from sproc either as a cursor column or as output parameter. To return as a column, replace
return  @string
--with 
SELECT @string
* VFP
lnRes = SQLExec(lnHandle,"EXEC getpersonaldatastring ?StrAppdi")
If you want return output parameter you've to declare it in sproc and asign value to it.
@StrAppdi varchar(50), @result varchar(4000) OUTPUT
...
SET @result = @@string
* VFP
lcRetVal = ""
lnres = SQLExec(lnHandle,"EXEC getpersonaldatastring ?StrAppdi, ?@lcRetVal")
IF lnres < 0
  * Use AERROR() to get detailed info about ODBC error
ENDIF
Also, your can use AERROR() function to get detailed info about ODBC error



>I just cant figure how to get the SP to return data to VFP
>
>When I try to call the SP from VFP I get a -1 error returned
>see below code for what I have tried
>
>
>
>SET QUOTED_IDENTIFIER ON
>GO
>SET ANSI_NULLS ON
>GO
>
>
>ALTER   PROCEDURE sp_getpersonaldatastring
>
>            @StrAppdi varchar(50)
>
>AS
>
>
>DECLARE @string varchar(4000)
>SET @string = ''
>
>SELECT @string = @string + CHAR(13) + dbo.DataClass.DataClassDesc
>FROM  dbo.SysDataClass INNER JOIN
>      dbo.DataClass ON dbo.SysDataClass.DataClassID = dbo.DataClass.DataClassID
>WHERE (dbo.SysDataClass.SystemID = @StrAppdi)
>ORDER BY dbo.SysDataClass.SystemID
>
>
>
>return  @string
>
>
>
>GO
>SET QUOTED_IDENTIFIER OFF
>GO
>SET ANSI_NULLS ON
>GO
>
>
>
>
>I am trying to call the SP with a parameter of '421' and I want my conatenated string returning in lcRetval
>
>
>
>
>and in VFP
>lcretval=''
>strAppid='421'
>
>? SQLExec(lnHandle,"EXEC getpersonaldatastring ?@lcRetVal ?StrAppdi")
>? SQLExec(lnHandle,"EXEC getpersonaldatastring '421'")
>
>they both return -1 :(
>
>
>
>
>Please just alter the SP for me so it works and give me the correct way to call it with a parameter from VFP before I go quite mad :(
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform