Ok, I figured out how to get the value back from a VFP stored procedure.
protected Int32 VFPGetNextID(String tablename)
{
String strCmd = "GetNextID('" + tablename.Trim().ToUpper() + "')";
Int32 retval = 0;
OleDbConnection myconn = new OleDbConnection(@"Provider=VFPOLEDB.1;Data Source=\\path\dbccontainer.DBC");
myconn.Open();
OleDbCommand cmd = new OleDbCommand(strCmd, myconn);
OleDbDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
retval = System.Convert.ToInt32(reader.GetValue(0));
}
reader.Close();
myconn.Close();
return retval;
}
Thanks for the help! One more roadblock down!
>>>Great question. I believe it was asked here two times and no solution was found how to retrieve output parameter from SP called by OleDB in .NET
>>
>>Why would you need an output parameter?
>>
>
>You need to get the ID back once you created a new record. In SQL Server it's SCOPE_IDENTITY(), but I remember few threads here (I think you participated in one of them) to get the ID (or output parameter) back from VFP SP. Don't recall good solution, but I can quickly find these threads again.