Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01055622
Message ID:
01055675
Vues:
15
Ok,

Here's the problem with my previous code, if there are no parameters present in your stored procedure, the OLEDB provider doesn't create the parameters object. I've tried to manually create the parameters object but haven't had much success. Here's a version that does work, however, you must pass in at least one parameter.
loConn = CREATEOBJECT('ADODB.Connection')
loConn = GetConnString()
loConn.Open()

loCmd  = CREATEOBJECT('ADODB.Command')
WITH loCmd
	.ActiveConnection = loConn
	.CommandType = 4              && Stored Procedure
	.CommandText = 'sp_test'
	.Parameters(1).Value = 'apl1keh'  && Need to pass at least one parameter to sp
ENDWITH

loCmd.Execute()

? loCmd.Parameters(0).Value
and the stored procedure:
alter PROCEDURE sp_test 
      @user_id   varchar(10)    AS

RETURN 33
Kurt


>This lvRetVal = loCmd.Parameters(0).Value gives error
>"Member PARAMETERS does not evaluate to an object"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform