Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DBC Stored Procedure Parameters
Message
De
31/08/2005 10:40:06
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Titre:
DBC Stored Procedure Parameters
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01045492
Message ID:
01045492
Vues:
62
I have a stored procedure in a VFP DBC that accepts a integer parameter. In .NET I can call this stored procedure if I hard code the parameter value in the CommandText property. But if I try to use the Command.Parameters collection to pass the parameter it fails.

Here's the working code:
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "EmployeeSalesByEmployee(5)";
** execute the stored procedure **
Here's the non-working code:
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "EmployeeSalesByEmployee(?)";
OleDbParameter param = new OleDbParameter("", 5);
cmd.Parameters.Add(param);
** execute the stored procedure **
This code fails with an OleDbException with a message of "Syntax Error".

Anybody know why this second technique does not work?
Thanks,
Dan Jurden
djurden@outlook.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform