Link to home
Start Free TrialLog in
Avatar of mservidio
mservidioFlag for United States of America

asked on

C# Oracle DataAccess CLOB insert issue

When I insert a CLOB to a table of some XML, starting with ?<, after the insert occurs and I look in the table data, the initial character (question mark), is flipped, and no longer a regular question mark but an upside down question mark which must be another character. Thus when reading it out, I get errors.

The variable test in this example is a string which holds the xml data.

What am I missing here? I have stepped through the code and ensured that when the parameter is set, that it indeed starts like ?<


OracleCommand command = new OracleCommand("insert into gridview (gridviewid,stream,id,description,collapsed) " +
                " values (gridview_seq.nextval,:stream,:id,:description,:collapsed) returning gridviewid into :gridviewid", conn);
            command.Parameters.Add(":stream", OracleDbType.Clob, test, ParameterDirection.Input);
            command.Parameters.Add(":id", OracleDbType.Int32, id, ParameterDirection.Input);
            command.Parameters.Add(":description", OracleDbType.Varchar2, textEdit1.Text, ParameterDirection.Input);
            command.Parameters.Add(":collapsed", OracleDbType.Int32,BoolToNumber(this.grid.IsCollapsed), ParameterDirection.Input);
            command.Parameters.Add(":gridviewid", OracleDbType.Int32, ParameterDirection.Output);
            
            command.ExecuteNonQuery();

Open in new window

Avatar of mservidio
mservidio
Flag of United States of America image

ASKER

Here is example of the data. First code is the data as set in the insert command param. Second code is the value after stored in the table.
Here is the value of variable test in the input parameter:

?<XtraSerializer version="1.0" application="View">
  <property name="#LayoutVersion" />
  <property name="PreviewIndent">-1</property>
  <property name="LevelIndent">-1</property>

Here is the value after it's stored in the table:

¿<XtraSerializer version="1.0" application="View">
  <property name="#LayoutVersion" />
  <property name="PreviewIndent">-1</property>
  <property name="LevelIndent">-1</property>


...etc

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mservidio
mservidio
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial