asp.net 和Oracle的过程简单问题,一直出错
protected void Button1_Click(object sender, EventArgs e)
{
string id = this.TextBox1.Text.Trim();
string name = this.TextBox2.Text.Trim();
string pwd = this.TextBox3.Text.Trim();
string sex = this.TextBox4.Text.Trim();
string strCn = "data source=zon;uid=system;pwd=pank;";
OracleConnection cn = new OracleConnection (strCn);
OracleCommand cmd = new OracleCommand("insaaa",cn);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter p1 = new OracleParameter("v_id", OracleType.Int32);
p1.Direction = ParameterDirection.Input;
p1.Value = id;
OracleParameter p2 = new OracleParameter("v_name",OracleType.VarChar,10);
p2.Direction = ParameterDirection.Input;
p2.Value = name;
OracleParameter p3 = new OracleParameter("v_pwd",OracleType.VarChar,20);
p3.Direction = ParameterDirection.Input;
p3.Value = pwd;
OracleParameter p4 = new OracleParameter("v_sex",OracleType.VarChar,15);
p4.Direction = ParameterDirection.Input;
p4.Value = sex;
cn.Open();
int count = cmd.ExecuteNonQuery();
cn.Close();
if (count > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('good!')</script>");
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('false!')</script>");
}
}
代码如上,
过程如下
create or replace procedure Insaaa
(v_id number,
v_name varchar2 ,
v_pwd varchar2,
v_sex varchar2
)as
begin
insert into aaa values (v_id,v_name,v_pwd,v_sex);
end;
过程没有错误,测试过了,但是程序调用就出错了,不知道为啥,高手指教,不胜感激;
ORA-06550: 第 1 行, 第 7 列:
PLS-00306: 调用 'INSAAA' 时参数个数或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored
------解决方案--------------------
楼主你的参数是定义了啊,但是你没有把它们添加到那个cmd中去也没有用啊