Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DBC Stored Procedure Parameters
Message
De
31/08/2005 11:11:35
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
31/08/2005 10:58:57
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:
01045517
Vues:
26
Sorry saw this later.
Cetin

>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?
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform