How can I use a stored procedure in my asp.net app

I'm trying to execute a stored procedure in my webform, I tried the next code:

OleDbCommand cmdtemp;
OleDbConnection conn;
conn =
new OleDbConnection(ConfigurationSettings.AppSettings["strConnection"].ToString());
cmdtemp =
new OleDbCommand("storeProc_1",conn);
cmdtemp.CommandType = CommandType.StoredProcedure;
try
{
conn.Open();
cmdtemp.ExecuteNonQuery();
conn.Close();
}
catch(Exception ex)
{
string Mensaje = ex.Message;
conn.Close();
}
And i got the message:"Unrecognized command verb." just when the ExecuteNonQuery is fired.

Any Idea?

[969 byte] By [Pepo] at [2008-2-8]
# 1

I haven't looked at your C# code in detail, but there doesn't seem to be a problem with it. The error you get is actually a VFP error (error 16). I think there is an error in your stored procedure. You may want to post it here. Does the SP work correctly when you call it in VFP? In VFP, set a breakpoint at line #1 and call the SP from the command window: storeproc_1().

EricdenDoop at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 2
the SP is working correctly, I have called it in VFP and it works but still can't work with it through asp.net. HEEEELP PLEASE!!!
Pepo at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 3

I change my code a little bit:

OleDbCommand cmdtemp;
OleDbConnection conn;
conn =
new OleDbConnection(ConfigurationSettings.AppSettings "strConnection"].ToString());
cmdtemp =
new OleDbCommand();
cmdtemp.CommandText = "storedprocedure_1()";
try
{
conn.Open();
cmdtemp.ExecuteNonQuery();
conn.Close();
}
catch(Exception ex)
{
string Mensaje = ex.Message;
conn.Close();
}

Now I get the next error message:
ExecuteNonQuery: Connection property has not been initialized

What's wrong?

Pepo at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 4
You seem to be missing the opening square bracket:

conn = new OleDbConnection(ConfigurationSettings.AppSettings ["strConnection"].ToString());

As for your fist message, I tend to agree with Eric's idea.

AlexFeldstein at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 5

thanx Alex but the square bracket is in my app indeed, I don't know why it's got lost in the copy-paste, and by the way i'm using Foxpro7 do you think that's the reason of my problem?

Pepo at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 6
No. VFP7 should work fine. But you are accessing it through OleDb? What's is the version of your OleDb provider?

The latest provider is here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=E1A87D8F-2D58-491F-A0FA-95A3289C5FD4&displaylang=en

See also:
http://fox.wikis.com/wc.dll?Wiki~VFPOleDBProvider
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_foxhelp9/html/7d6c2f1e-1426-4072-bacd-e834d800a366.asp

AlexFeldstein at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...