Dear Jiri,

Many thanks for your answer.
The example shows how to update a blob field in a table. I want to pass the 
blob data to an UDF function


File reading works with:
                fbCommand.CommandText = "select F_GETFILE('c:\\test.txt') from 
rdb$database";
                FbDataAdapter BolbAdapter = new FbDataAdapter(fbCommand);
                System.Data.DataSet BlobDataSet = new DataSet("BlobDataSet");
                BolbAdapter.Fill(BlobDataSet);
                return (byte[])BlobDataSet.Tables[0].Rows[0][0];

My UDF function is:

DECLARE EXTERNAL FUNCTION F_SETFILE
CSTRING(255) CHARACTER SET NONE, BLOB
RETURNS INTEGER FREE_IT
ENTRY_POINT 'SETARCFILE' MODULE_NAME 'mydll.dll';

My idea was:

                fbCommand.CommandText = "SELECT F_SETFILE('c:\\test.txt', 
@MYBLOB) from rdb$database";
                fbCommand.Parameters.Add("@MYBLOB", FbDbType.Binary);

// data is an byte[] which contains the file data
                fbCommand.Parameters[0].Value = data;

                FbDataReader fbReader = fbCommand.ExecuteReader();
                    if (fbReader.HasRows)
                    {
                        while (fbReader.Read())
                        {

// My return code contains error code or number of bytes written
                                     RC = fbReader.GetInt32(0);
                        }
                    }
But exception on fbCommand.ExecuteReader();

Any idea?
Best regards
Klaus




-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Jiri Cincura
Gesendet: Donnerstag, 10. Juli 2008 00:07
An: For users and developers of the Firebird .NET providers
Betreff: Re: [Firebird-net-provider] UDF function with blob data

Something like 
http://www.firebirdsql.org/index.php?op=devel&sub=netprovider&id=examples#2
.


--
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider




-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to