오라클에 이진 데이타를 쓰는 예제입니다.
int bytes; string que = "SELECT * FROM T_PROJECT_SETTING"; FileStream fs = new FileStream(sPrjIniFilePath, FileMode.Open, FileAccess.Read); byte[] byteArray = new byte[fs.Length - 1]; fs.Read(byteArray, 0, byteArray.Length); fs.Close(); FileInfo fi = new FileInfo(sPrjIniFilePath); string filename = fi.Name; using (OracleCommand comm = new OracleCommand("INSERT INTO T_PROJECT_SETTING (C_FILE_NAME,C_SETTING_DATA) VALUES('" + filename + "', :FILEDATA)", Oracleconn)) { OracleParameter para = new OracleParameter(); para.ParameterName = ":FILEDATA"; para.OracleDbType = OracleDbType.Blob; para.Direction = ParameterDirection.Input; para.Size = byteArray.Length - 1; para.Value = byteArray; comm.Parameters.Add(para); int cntResult = comm.ExecuteNonQuery(); comm.Parameters.Clear(); }
댓글
댓글 쓰기