大家好 谁可以帮我看一下这段代码出什么问题了啊! 谢谢
protected void Button1_Click(object sender, EventArgs e)
{
string cnstr = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
OracleConnection con = new OracleConnection(cnstr);
OracleCommand cmd = con.CreateCommand();
cmd.Connection = con;
//赋SQL语句
cmd.CommandText = "insert into t_company(companyname,id_father,state) values(@companyname,@id_father,@state)";
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add("@companyname", OracleType.VarChar, 60);
cmd.Parameters.Add("@id_father", OracleType.Number);
cmd.Parameters.Add("@state", OracleType.Number);
//赋字段值
cmd.Parameters["@companyname"].Value = TextBox1.Text;
cmd.Parameters["@id_father"].Value = DropDownList1.Text;
cmd.Parameters["@state"].Value = DropDownList3.Text;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
抱的错误是 在 cmd.ExecuteNonQuery();报
ORA-01036: 非法的变量名/编号