It took a while to find information but I re-read chapter 5 of "What's New in VFP 7" which discussed the new OLE DB provider than I'm using to connect. It supports many of the VFP functions. So the code below works. However, I am attempting to figure out is it better to use a return value (the PK) from a procedure then passing the value to the standard Ado.net update and add routines. Or is attempting to use the stored procedure from the insert (by inserting it into the call into the command text better?
private void insertbutton_Click(object sender, System.EventArgs e)
{
oleDbConnection1.Open();
//serialnumber() is a stored procedure written by a member of the UT
//serialnumber('esagency')
string sqlSelect = "INSERT INTO mytest (agencyid,name)VALUES (serialnumber('esagency'),'test')";
System.Data.OleDb.OleDbCommand mysqlcmd = new System.Data.OleDb.OleDbCommand(sqlSelect,oleDbConnection1);
mysqlcmd.ExecuteNonQuery();
oleDbConnection1.Close();
}
John Fabiani
Woodland, CA