title: Visual Foxpro Database Stored Procedure with Oledb Provider
body: <p>I am using Visual Foxpro 8.0 database. Below procedure I am using to return records from database on basis of condition matching but it raised error that:</p>
  
  <blockquote>
    <p>"Function is not implemented."</p>
  </blockquote>
  
  <p>Foxpro Procedure ------------------------</p>
  
  <pre><code>PROCEDURE FX_Proc_ValidateUser (paramUserName AS Character, paramPassword AS Character)
  LOCAL VarUserName AS Character, varXml
  VarUserName = IIF(VARTYPE(paramUserName)!="N","",paramUserName)
  LOCAL VarPassword AS Character
  VarPassword = IIF(VARTYPE(paramPassword)!="N","",paramPassword)
  SELECT userinfoid, ;
          username, ;
          password ;
  FROM tm_userinfo.dbf ;
  WHERE username = VarUserName AND password = VarPassword ;
  INTO CURSOR procResult  
  varXml = ""
  CURSORTOXML("procResult","varXml",1,32,0,"1")
  RETURN varXml
  ENDPROC
  </code></pre>
  
  <p>Front End code for calling this procedure------------------</p>
  
  <pre><code>string ConnectionString = "Provider=VFPOLEDB.1;Data Source=C:\Users\raj\Documents\Visual FoxPro Projects\dbFoxMaster.dbc;Collating Sequence=machine;" providerName="System.Data.OleDb.OleDbConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
  OledbConnection objOleDbConnection = new OleDbConnection(ConnectionString);
  objOleDbConnection.Open();
  OleDbCommand objOleDbCommand = new OleDbCommand();
  objOleDbCommand.CommandType = CommandType.StoredProcedure;
  objOleDbCommand.CommandText = "FX_Proc_ValidateUser";
  objOleDbCommand.Connection = objOleDbConnection;
  objOleDbCommand.Parameters.Add("paramUserName", OleDbType.Char).Value = "abc";
  objOleDbCommand.Parameters.Add("paramPassword", OleDbType.Char).Value = "123";
  var xmlString = oOleDbCommand.ExecuteScalar().ToString();
      DataTable table = new DataTable();
      using (var reader = new StringReader(xmlString))
      {
          var dataSet = new DataSet();
  
          // creating a dataset from the xml 
          dataSet.ReadXml(reader);
          table = dataSet.Tables[0];
      }
  </code></pre>
  
  <p>How to get resultset from foxpro 8.0 stored procedure using OledbCommand?</p>