OracleConnection oc = new OracleConnection ("data source = osserver; User Id = *****; password = **");
OracleCommand cmd = new OracleCommand ("insert into cym1.previusfile (filename, filecontent) values (: filename,: filecontent)", oc );
OracleParameter op1 = new OracleParameter ("filename", OracleType. VarChar, 256 );
OracleParameter op2 = new OracleParameter ("filecontent", OracleType. Blob, filedata. Length );
Op1.Value = System. IO. Path. GetFileName (File1.Value );
Cmd. Parameters. Add (op1 );
Op2.Value = filedata;
Cmd. Parameters. Add (op2 );
Oc. Open ();
Cmd. ExecuteNonQuery ();
Oc. Close ();
In ORACLE, the SQL statement parameter is: + Parameter Name,
Insert into cym1.previusfile (filename, filecontent) values (: Filename,: Filecontent)
You do not need to write the parameter name in the parameter variable that defines this parameter:
OracleParameter op1 = new OracleParameter ("Filename", OracleType. VarChar, 256 );
SqlConnection conn = new SqlConnection ("data source = ccserver; user id = sa; password = ***; initial catalog = cym1 ");
SqlCommand cmd = new SqlCommand ("insert into previusfile (filename) values (@ filename)", conn );
SqlParameter sp = new SqlParameter ("@ filename", SqlDbType. VarChar, 256 );
Sp. Value = "1.jpg ";
Conn. Open ();
Cmd. ExecuteNonQuery ();
Conn. Close ();
In SQLSERVER, the SQL statement parameter is @ +,
Insert into previusfile (filename) values (@ filename)
In the parameter variable that defines this parameter, the parameter must be written @
SqlParameter sp = new SqlParameter ("@ filename", SqlDbType. VarChar, 256 );