Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DBC Stored Procedure Parameters
Message
De
31/08/2005 10:58:57
 
 
À
31/08/2005 10:40:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01045492
Message ID:
01045505
Vues:
21
Nevermind. I found it. The when using the Command.Parameters the command text does not have to include the parameters. So this works:
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "EmployeeSalesByEmployee";
OleDbParameter param = new OleDbParameter("", 5);
cmd.Parameters.Add(param);
** execute the stored procedure **
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform