附加信息:ORA-01460:请求未实现或不合理的转换

时间:2018-09-10 09:44:28

标签: c# asp.net visual-studio-2015 oracle11g blob

我正在尝试在oracle数据库中上传图片,我正在尝试从表单提交中上传图片。如果不上传图像,一切将正常运行。上传图片时,我收到“ Additional information: ORA-01460: unimplemented or unreasonable conversion requested

让我解释一下我的代码:

这是我的控制者:

public ActionResult SaveUser(string oid, string fname, string uname, string pass, string pass2, string bt, HttpPostedFileBase image)
        {


            string iuser = Session["UserID"].ToString();
            string fileName = Path.GetFileName(image.FileName);
            String fileExtension = Path.GetExtension(fileName);
            int fileSize = image.ContentLength;


            Stream stream = image.InputStream;
            BinaryReader binaryReader = new BinaryReader(stream);
            byte[] bytes = binaryReader.ReadBytes((int)stream.Length);



            if (pass == pass2)
            {
                if (bt == "0")
                {
                    string packge = "tflhr.pro_new_user.insert_data";
                    _clsDataAccess.package_user(packge, fname, uname, pass, bytes , iuser );

                }
                else if (bt == "1")
                {
                    strComm = "update tflhr.T_USER set USER_NAME='" + fname + "',USER_ENID= '" + uname + "',USER_PASS='" + pass + "',EUSER='"+ iuser + "',IMAGE='" + bytes + "' where OID ='" + oid + "'";
                    _clsDataAccess.read_data(strComm);
                }
            }

            return RedirectToAction("User", new { cpid = 0, bt = 0 });
        }

这是课程:

   public DataSet package_user(string package, string fname, string pass, string uname, byte[] bytes, string iuser)
        {


            conn = new OracleConnection(clsConnection.ConnectionSave);
            conn.Open();
            cmd = new OracleCommand(package, conn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("cur_c1", OracleType.Cursor).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("user_name", OracleType.VarChar).Value = fname;
            cmd.Parameters.Add("user_pass", OracleType.VarChar).Value = pass;
            cmd.Parameters.Add("user_enid", OracleType.VarChar).Value = uname;
            cmd.Parameters.Add("bytes", OracleType.Blob).Value = bytes;
            cmd.Parameters.Add("iuser", OracleType.VarChar).Value = iuser;
            cmd.Parameters.Add("euser", OracleType.VarChar).Value = iuser;


            oda = new OracleDataAdapter(cmd);
            ds = new DataSet();

            conn.Close();
            oda.Fill(ds);
            return ds;

        }

以下是步骤:

CREATE OR REPLACE PACKAGE BODY TFLHR.pro_new_user as
procedure insert_data (cur_c1 out t_cursor, user_name in varchar2, user_pass in varchar2,
user_enid in varchar2, bytes in blob, iuser in varchar2, euser in varchar2)
is
code varchar2(5);
begin
select nvl(max(to_number(user_text)),0)+1 into code from tflhr.t_user;
insert into tflhr.t_user (oid, user_text, user_name, user_pass, user_enid,image, iuser, euser,user_path)
values
('USERx'||lpad(code,5,'0'), lpad(code,5,'0'), user_name, user_pass, user_enid, bytes, iuser, euser, lpad(code,5,'0'));
open cur_c1 for
select '1' from dual;
        commit;
    end insert_data;
end;
/

但是上传图片时出现此错误:ORA-01460: unimplemented or unreasonable conversion requested

请帮助我解决此问题。给我合适的参考。谢谢

0 个答案:

没有答案