Note that there are some explanatory texts on larger screens.

plurals
  1. POInsert byte[] to blob column in Informix DB using c#
    primarykey
    data
    text
    <p>Just like these links</p> <p><a href="https://stackoverflow.com/questions/6267159/sql-informix-how-do-i-add-a-blob-when-doing-an-insert-using-the-net-c-s/16790499#16790499/" title="LINK 1">Link 1</a></p> <p><a href="https://stackoverflow.com/questions/6319858/informix-c-how-do-i-properly-set-unset-a-blob-field" title="LINK 2">Link 2</a></p> <p><a href="https://stackoverflow.com/questions/4467562/operations-on-blob-data-in-informix" title="LINK 3">Link 3</a></p> <p><a href="https://stackoverflow.com/questions/6267159/sql-informix-how-do-i-add-a-blob-when-doing-an-insert-using-the-net-c-s" title="*** LINK 4 ***"><strong>Link 4</strong></a></p> <p>Am also unable to insert only byte[] related operations on my informix database. I tried many ways and gone through IBM site. but no where its explained "how to use byte[] to insert into blob column using c#". </p> <p>"LINK 4" is very helpful. but am facing problem with this code. </p> <pre><code>Error: The %0 enumeration value, %1, is invalid. At line: blob.Open(IfxSmartLOBOpenMode.ReadWrite); if i use cmd.Parameters.Add(new IfxParameter()).Value = byteuploaded`; </code></pre> <p>Here is my code snippet.</p> <pre><code>protected void uploadfile_Click(object sender, EventArgs e) { string extension; // checks if file exists if (!_imageUpload.HasFile) { _resultLbl.Text = "Please, Select a File!"; return; } // checks file extension extension = System.IO.Path.GetExtension(_imageUpload.FileName).ToLower(); if (!extension.Equals(".jpg") &amp;&amp; !extension.Equals(".jpeg") &amp;&amp; !extension.Equals(".png")) { _resultLbl.Text = "Only image files (.JPGs and .PNGs) are allowed."; return; } try { // ========= This is not working ============== string sqlQuery = "insert into db95:TestBlobUpload (id ,fileblob) values('2', 'two');"; // ========= This is working properly ============== //string sqlQuery = "insert into db95:TestBlobUpload (id ,filetext) values('4',?);"; string connString = "Database=db95;Host=172.16.XX.XX;Server=vsXXXX;Service=88;Protocol=onsoctcp;UID=ed;Password=ca94;"; using (this.connection = new IfxConnection(connString)) { this.connection.Open(); using (this.cmd = new IfxCommand(sqlQuery, this.connection)) { // Start a local transaction this.trans = this.connection.BeginTransaction(IsolationLevel.Unspecified); // Assign transaction object for a pending local transaction this.cmd.Transaction = trans; try { IfxBlob byteuploaded = new IfxBlob(this.connection); byteuploaded.Read(_imageUpload.FileBytes); // ========= BOTH OF THESE are not working ============== //cmd.Parameters.Add(new IfxParameter()).Value = data;// System.Text.Encoding.UTF8.GetString(data); cmd.Parameters.Add(new IfxParameter()).Value = byteuploaded;// _imageUpload.FileBytes; int res = cmd.ExecuteNonQuery(); // commiting the transaction this.cmd.Transaction.Commit(); } catch { //this.cmd.Transaction.Rollback(); } } this.connection.Close(); } } catch (Exception) { } } </code></pre> <p>am using this dll as a reference and using IBM.Data.Informix;</p> <p><img src="https://i.stack.imgur.com/ysWpu.png" alt="enter image description here"></p> <p>particularly am unable to add byte[] to blob columns. All other insert/update/delete operations i can do.</p> <p>Any help?</p> <p>I even upgraded to ibm_data_server_driver_package_win64_v10.1.exe &amp; clientsdk.4.10.FC1DE.WIN.exe</p> <p>But am facing problems with dll compatibility. unable to load'XX.XX.dll" exception is comin.</p> <p>I even tried to execute the insert query using </p> <pre><code>INSERT INTO db95@vsXXXX:testblobupload (fileblob) VALUES (db95@vsXXXX:FILETOBLOB('C:\tmp\Untitled.png', 'client')); </code></pre> <p>and facing error as </p> <pre><code>ERROR: Smart-large-object error. Error Code: -9810. Smart Large Objects: No sbspace number specified. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload