hi,

i have a problem writing a blob to oracle using ado.net. maybe someone can
help.
here's my code:

OleDbConnection con = new OleDbConnection("Provider=msdaora;Data
Source=orcl;User Id=******;Password=******;");
try
{
con.Open();
string save_blob = "INSERT INTO blobtable "
+ "(id,content) "
+ "VALUES "
+ "(1,:contentParam)";

OleDbParameter contentParameter = new OleDbParameter();
contentParameter.OleDbType = OleDbType.LongVarBinary;
contentParameter.ParameterName = "contentParam";
contentParameter.Value = this.content; // where content is an array of byte
OleDbCommand command = new OleDbCommand(save_blob, con);
command.Parameters.Add(contentParameter);
command.ExecuteNonQuery();
command.Dispose();
}
catch (Exception ex)
{
System.Diagnostics.Debug.Write("DATABASE ERROR:" + ex);
}
finally
{
con.Close();
}


now everytime i try and run that code i get the following error:
A first chance exception of type 'System.Data.OleDb.OleDbException' occurred
in System.Data.dll
DATABASE ERROR:System.Data.OleDb.OleDbException: ORA-01008: not all
variables bound
any ideas?

Re: problem writing blob to oracle by tomb

tomb
Thu May 04 22:20:34 CDT 2006

Instead of using the OleDbConnection, get the OracleDataAdapter from
Oracle. It works great. because it is native for Oracle. And you'll
also want to use a variable of type OracleClient.OracleLob. I did this
a while back in VB.net, but the principle is the same. The Oracle
documentation should have whatever else you need.

Tom

Achim Kuehn wrote:

>hi,
>
>i have a problem writing a blob to oracle using ado.net. maybe someone can
>help.
>here's my code:
>
>OleDbConnection con = new OleDbConnection("Provider=msdaora;Data
>Source=orcl;User Id=******;Password=******;");
>try
>{
>con.Open();
>string save_blob = "INSERT INTO blobtable "
>+ "(id,content) "
>+ "VALUES "
>+ "(1,:contentParam)";
>
>OleDbParameter contentParameter = new OleDbParameter();
>contentParameter.OleDbType = OleDbType.LongVarBinary;
>contentParameter.ParameterName = "contentParam";
>contentParameter.Value = this.content; // where content is an array of byte
>OleDbCommand command = new OleDbCommand(save_blob, con);
>command.Parameters.Add(contentParameter);
>command.ExecuteNonQuery();
>command.Dispose();
>}
>catch (Exception ex)
>{
>System.Diagnostics.Debug.Write("DATABASE ERROR:" + ex);
>}
>finally
>{
>con.Close();
>}
>
>
>now everytime i try and run that code i get the following error:
>A first chance exception of type 'System.Data.OleDb.OleDbException' occurred
>in System.Data.dll
>DATABASE ERROR:System.Data.OleDb.OleDbException: ORA-01008: not all
>variables bound
>any ideas?
>
>
>
>