Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the return value from a foxpro stored procedure
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00821760
Message ID:
00821890
Vues:
24
This message has been marked as the solution to the initial question of the thread.
Hi Christopher,

You want to use ExecuteScalar instead of ExecuteNonQuery. ExecuteNonQuery will not return any values where ExecuteScalar will return a value. Change the following:
vfpNextId.ExecuteNonQuery();
to the following:
int myreturn;
myreturn = vfpNextId.ExecuteScalar();
>Is there any way to get a return value from a stored procedure? Here is the code that I am using. I need to get the return value of the stored procedure "getnextid()."
>
>OleDbConnection myConnection = new OleDbConnection();
>myConnection.ConnectionString = ConfigurationSettings.AppSettings["DataPath"];
>
>OleDbCommand vfpNextId = new OleDbCommand();
>vfpNextId.Connection = myConnection;
>vfpNextId.CommandText = "getnextid( asnctlg, id_asnctlg )";
>
>myConnection.Open();
>
>try
>{
> vfpNextId.ExecuteNonQuery();
>}
>catch(Exception ex)
>{
> this.SetError(ex.Message);
> return false;
>}
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform