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.comwww.prenia.comWeblog: blogs.prenia.com/cathi