开发者

ORA-06550 exception while calling oracle stored procedure from C#

I'm trying to call an oracle stored procedure from my C# application and I get the following error:

ORA-06550: line 1, column 7:

PLS-00306: wrong number or types of arguments in call to 'DELETE_SEARCH'

ORA-06550: line 1, column 7:

PL/SQL: Statement ignored

The procedure declaration is:

PROCEDURE delete_search (user_ip IN VARCHAR2)

and th C# code that suppose to call it is:

OracleCommand cmd;
OracleParameter param;
for (int i = 0; i < data.Tables[0].Rows.Count; i++)
{
    if (decimal.Parse(data.Tables[0].Rows[i][1].ToString()) < numericUpDown1.Value)
    {
        cmd = new OracleCommand("delete_search", Form1.conn());
        cmd.Parameters.Clear();
        cmd.CommandType = CommandType.StoredProcedure;
        param = new OraclePar开发者_StackOverflow中文版ameter();
        param.ParameterName = "ip";
        param.Value = data.Tables[0].Rows[i][0].ToString();
        param.Direction = ParameterDirection.Input;
        param.OracleType = OracleType.VarChar;
        cmd.Parameters.Add(param);
        Form1.adapter().SelectCommand = cmd;
        Form1.adapter().SelectCommand.ExecuteNonQuery();
    }
}    

and of course the exception is thrown in the line:

Form1.adapter().SelectCommand.ExecuteNonQuery();

What can be the problem?


shouldn't

param.ParameterName = "ip";

be

param.ParameterName = "user_ip";


You are passing wrong param name. It should be

param.ParameterName = "user_ip";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜