CetinBasoz
There is no stored procedure call like:
"DO process_location_view_tables"
DO is a VFP keyword an should never be used in place of a stored procedure name. If it was really a stored procedure name, then instead of passing the parameter like that, use OleDbParameter. ie:
string lcConStr = @"Provider = VFPOLEDB;Data Source=c:\my Path\testdata.dbc;";
OleDbConnection loConnection = new OleDbConnection(lcConStr);
loConnection.Open();
OleDbCommand loCommand = new OleDbCommand();
loCommand.Connection = loConnection;
loCommand.CommandText="GetCustomerMax"; // sample stored procedure returning scalar value
OleDbParameter parm = new OleDbParameter("","ALFKI");
loCommand.Parameters.Add(parm);
loCommand.CommandType=CommandType.StoredProcedure;
try
{
decimal rv = (decimal)loCommand.ExecuteScalar();
Console.WriteLine(rv);
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
loConnection.Close();
}
As I see you're using VFP7 naming your objects and stored procedure as your SelectCommand (probably jus a misnomer). If your intend is to return a resultset then you need VFP9 and later. VFP7 stored procedures can only return a scalar value. Stored procedures do return a value and you should use ExecuteScalar() or ExecuteQuery() depending on what you expect. ie: A VFP9 stored procedure could return a resultset:
string strConn = @"Provider=VFPOLEDB;Data source=c:\my Path\myDatabase.dbc;";
OleDbConnection cn = new OleDbConnection(strConn);
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = cn;
cmd.CommandText = "myStoredProcedure";
cmd.CommandType = CommandType.StoredProcedure;
OleDbParameter userID = cmd.Parameters.Add("userID",2);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
foreach (DataRow row in ds.Tables[0].Rows)
{
Console.WriteLine((string)row["UserName"]);
}
}
PS: It's never wise to create tables from a stored procedure over and over. Maybe all you need is to return a resultset or a nested XML etc.
I do not think you really ran that as a stored procedure from within VFP9. Probably actual stored procedure name was part after "do" with no parameters. Keep in mind not all commands and functions are supported through OLEDB calls (check supported/unsupported in VFP help).