using System; using System.Data; using System.Data.OleDb; namespace TestData { /// <summary> /// Summary description for TestData. /// </summary> public class TestData { public TestData() { string myConnString = "Provider=VFPOLEDB.1;Data Source=C:\\TEMP\\DATA\\TASTRADE.DBC;Mode=Share Deny None;" + "Extended Properties=\"\";User ID=\"\";Password=\"\";Mask Password=False;" + "Cache Authentication=False;Encrypt Password=False;Collating Sequence=MACHINE"; OleDbConnection myConnection = new OleDbConnection(myConnString); string myCmd; myCmd = "DeleteOrder<b>()</b>" ; // Stored procedure that just deletes one record with DELETE - SQL command. Note the parens. OleDbCommand myCommand = new OleDbCommand(myCmd,myConnection); myConnection.Open(); int cmdResults = -1 ; // myCommand.CommandType = CommandType.StoredProcedure ; myCommand.CommandType = CommandType.Text ; // StoredProcedure does not work. ADO strips the parens off and VFP requires them. try { cmdResults = myCommand.ExecuteNonQuery(); // NonQuery since no SQL rows are returned } catch(System.Data.OleDb.OleDbException e) { Console.WriteLine("Error occured: " + e.Message); } finally { myConnection.Close(); Console.WriteLine("cmdResults " + cmdResults); Console.ReadLine(); } } public static void Main() { TestData foo = new TestData(); } } }My stored proc was simply:
PROCEDURE DeleteOrder SET ANSI OFF DELETE FROM ORDERs WHERE ORDER_ID = " 2" && Just testing concept. USE IN ORDERS USE ORDERS EXCLUSIVE PACK RETURN ENDPROCYou might want to note the VFP help topic "Unsupported Visual FoxPro Commands and Functions." However, this is not, apparently, exhaustive. I had an error (feature not available) trying to use STRTOFILE().