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

Click here to load this message in the networking platform