Insert a word Document into database
-
How should i insert a word document into database. I defined a Blob field in the database and i used this code FileStream fls; fls = new FileStream(path, FileMode.Open, FileAccess.Read); byte[] blob = new byte[fls.Length]; fls.Read(blob, 0, System.Convert.ToInt32(fls.Length)); fls.Close(); query = "insert into Example(BLOBField)values(:BlobParameter)"; OracleParameter blobParameter = new OracleParameter(); blobParameter.OracleType = OracleType.Blob; blobParameter.ParameterName = "BlobParameter"; blobParameter.Value = blob; conn.Open(); cmnd = new OracleCommand(query, conn); cmnd.Parameters.Add(blobParameter); cmnd.ExecuteNonQuery(); cmnd.Dispose(); conn.Close(); What am i doing wrong. Its throwing up an error. Is there any other way to do this. Thanks Kal
-
How should i insert a word document into database. I defined a Blob field in the database and i used this code FileStream fls; fls = new FileStream(path, FileMode.Open, FileAccess.Read); byte[] blob = new byte[fls.Length]; fls.Read(blob, 0, System.Convert.ToInt32(fls.Length)); fls.Close(); query = "insert into Example(BLOBField)values(:BlobParameter)"; OracleParameter blobParameter = new OracleParameter(); blobParameter.OracleType = OracleType.Blob; blobParameter.ParameterName = "BlobParameter"; blobParameter.Value = blob; conn.Open(); cmnd = new OracleCommand(query, conn); cmnd.Parameters.Add(blobParameter); cmnd.ExecuteNonQuery(); cmnd.Dispose(); conn.Close(); What am i doing wrong. Its throwing up an error. Is there any other way to do this. Thanks Kal
kalyanPaladugu wrote:
Its throwing up an error.
It might be helpful to say what the error is you are getting.
only two letters away from being an asset
-
kalyanPaladugu wrote:
Its throwing up an error.
It might be helpful to say what the error is you are getting.
only two letters away from being an asset
ORA-00600:internal error code, arguments: [koklgloblen:bnd][],[],[],[],[],[],[] Thats the error its throwing. Iam able to insert ordinary values like int and varchar but not blobs
-
ORA-00600:internal error code, arguments: [koklgloblen:bnd][],[],[],[],[],[],[] Thats the error its throwing. Iam able to insert ordinary values like int and varchar but not blobs
I figured out the error. I was able to insert into the database. My second question is how should i retrieve it from the database. If i execute the statement select * from table name its showing as orablob in those columns i inserted. Is that the normal behaviour. Can some body provide the code to retrieve the word document from the database Thanks Kal
-
I figured out the error. I was able to insert into the database. My second question is how should i retrieve it from the database. If i execute the statement select * from table name its showing as orablob in those columns i inserted. Is that the normal behaviour. Can some body provide the code to retrieve the word document from the database Thanks Kal
kalyanPaladugu wrote:
Can some body provide the code to retrieve the word document from the database
Probably
kalyanPaladugu wrote:
I figured out the error. I was able to insert into the database.
How about you share your solution. Its called give and take
Objects in mirror are closer than they appear
-
kalyanPaladugu wrote:
Can some body provide the code to retrieve the word document from the database
Probably
kalyanPaladugu wrote:
I figured out the error. I was able to insert into the database.
How about you share your solution. Its called give and take
Objects in mirror are closer than they appear
Its the same thing. The above code in the first link should work. Previously i was inserting into two blob fields in the database from the same file stream object and so it failed. So i created two file stream objects for two blob fields and it seem to work. So if you run the code as it is i posted it should work as it is only one blob field in the database and one file stream object to load that Thanks Kal
-
Its the same thing. The above code in the first link should work. Previously i was inserting into two blob fields in the database from the same file stream object and so it failed. So i created two file stream objects for two blob fields and it seem to work. So if you run the code as it is i posted it should work as it is only one blob field in the database and one file stream object to load that Thanks Kal
How to retrieve the data from the blob field in the database Thanks Kal