>MODIFY PROCEDURE >>In opening window type the following (suppose there's ACCOUNTS table in the database):
>PROCEDURE sp_ZapAccounts > USE accounts EXCLUSIVE > ZAP > >PROCEDURE sp_PackAccounts > USE accounts EXCLUSIVE > PACK >>Save and close. Also close the database. Note that both PACKing and ZAPping require exclusive access to tables.
>using System; >using System.Data; >using System.Data.OleDb; > >namespace AccessingVFPviaOleDb >{ > class Class1 > { > [STAThread] > static void Main(string[] args) > { > ZapAccounts(); > } > > static void ZapAccounts() > { > string ConnStr = "Provider=vfpoledb.1;" + > "Data Source=C:\\MYDATA\\TEST.DBC;" + > "Collating Sequence=machine"; > > OleDbConnection cn = new OleDbConnection(ConnStr); > > try > { > cn.Open(); > OleDbCommand cmd = new OleDbCommand("sp_ZapAccounts()", cn); > cmd.ExecuteNonQuery(); > } > catch (Exception e) > { > Console.Write(e.Message); > return; > } > finally > { > cn.Close(); > } > } > } >} >>As you can see, the code creates a OleDb connection to the database and executes a single SQL statement, which is the name of a stored procedure (don't forget to put round brackets).