Reputation: 173
I'm trying to store my image into database which have blob datatype and I have created blob named byte which stores all content of that image. I have created a method called ReadFile(FullPath)
to get the image content, but while storing this value I'm getting an following error :
ORA-00984: column not allowed here
Please help me to solve this problem.
string file_id_is = db.getData(select_fileid_query).ToString();
int I_File_Id = Convert.ToInt32(file_id_is);
string FileName = System.IO.Path.GetFileName(PostedFile.FileName);
string FileContentType = System.IO.Path.GetFileName(PostedFile.ContentType);
string FullPath = System.IO.Path.GetFullPath(PostedFile.FileName);
byte[] blob = ReadFile(FullPath);
string Query = "insert into JOINTING_FILES_DETAILS (ID,DRAFTSMAN_FILES_ID,FILE_NAME,CONTENT_TYPE,DATA)
values (JOINTING_UPLOADED_SEQ.NEXVAL,:file_id,:FileNameis,:FileType,:BlobParameter)";
using (OracleCommand cmd2 = new OracleCommand(Query, connection.get()))
{
try
{
cmd2.Parameters.Add("file_id", I_File_Id);
cmd2.Parameters.Add("FileNameis", FileName);
cmd2.Parameters.Add("FileType", FileContentType);
cmd2.Parameters.Add("BlobParameter", blob);
cmd2.ExecuteNonQuery();
}
catch(Exception e)
{
Response.Write(e.Message)
}
}
Upvotes: 0
Views: 823
Reputation: 40970
It looks like that you made a typo for accessing the next value of the sequence. Here is the documentation to use this
So try changing
JOINTING_UPLOADED_SEQ.NEXVAL
to
JOINTING_UPLOADED_SEQ.NEXTVAL
Upvotes: 2