Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBC Stored Procedure Parameters
Message
From
31/08/2005 10:40:06
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Title:
DBC Stored Procedure Parameters
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01045492
Message ID:
01045492
Views:
64
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
Next
Reply
Map
View

Click here to load this message in the networking platform