Estou tentando salvar imagem no banco de dados Oracle, segue o código
private void btnInsereFoto_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "JPG Files(*.jpg)|*.jpg|PNG Files(*.png)|*.png|AllFiles(*.*)|*.*";
if (dialog.ShowDialog() == DialogResult.OK)
{
string foto = dialog.FileName.ToString();
txtDiretorio.Text = foto;
pbFotoAluno.ImageLocation = foto;
}
}
private void Foto()
{
byte[] FotoByte = null;
FileStream fstream = new FileStream(this.txtDiretorio.Text, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fstream);
FotoByte = br.ReadBytes((int)fstream.Length);
string sintax = "INSERT INTO TCC.TBAlunoFoto(Foto, FKRMAluno)" +
"VALUES(@Foto, @FKRMAluno)";
string connectionCOM = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521)))(CONNECT_DATA=(SID=xe)));User ID=SYS;Password=123456;
DBA Privilege=SYSDBA;";
OracleConnection Conexao = new OracleConnection(connectionCOM);
OracleCommand Comando = new OracleCommand(sintax, Conexao);
OracleDataReader dr;
try
{
Conexao.Open();
Comando.Parameters.Add(new OracleParameter("@Foto", FotoByte));
Comando.Parameters.Add(new OracleParameter("@FKRMAluno", txtRMAluno.Text));
dr = Comando.ExecuteReader();
MessageBox.Show("Imagem Inserida!");
}
catch (Exception ex)
{
throw ex;
}
finally
{
Conexao.Close();
}
}
Quando tento realizar o cadastro, o erro {"ORA-00936: missing expression"} me é informado, gostaria de saber se alguém sabe como resolver. Agradeço!