Error when inserting Thai characters into Oracle using ASP.NET/VB.NET backend with OLE DB

Posted on 2004-11-09
Last Modified: 2013-11-25
I am able to select Thai characters from an Oracle DB using OLE DB and display them on a web form. When I take the same web form with Thai characters to insert into the DB I get the error below.

1) Is it possible to use OLE DB to insert Thai characters in Oracle?
2) If the answer is yes to #1, how can it be done?
3) Is there any glaring problems with the code below that would prevent this from working?

            Me.OleDbInsertCommand1.Parameters("RESPECT").Value = rdbList1.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("RESPECT_COMM").Value = txtRespect_Comm.Text
            Me.OleDbInsertCommand1.Parameters("SPIRIT").Value = rdbList2.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("SPIRIT_COMM").Value = txtSpirit_Comm.Text
            Me.OleDbInsertCommand1.Parameters("LEADER").Value = rdbList3.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("LEADER_COMM").Value = txtLeader_Comm.Text
            Me.OleDbInsertCommand1.Parameters("OVERALL").Value = rdbList4.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("OVERALL_COMM").Value = txtOverall_Comm.Text
            Me.OleDbInsertCommand1.Parameters("COMMENTS").Value = txtComments.Text
            Me.OleDbInsertCommand1.Parameters("SHIFT").Value = rdbListShift.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("DEPT").Value = txtDept.Text
            Me.OleDbInsertCommand1.Parameters("EMP_STATUS").Value = rdbListStatus.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("GP_BU").Value = ddListBU.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("BEST_COMM").Value = txtBest_Comm.Text
            Me.OleDbInsertCommand1.Parameters("RECOMMEND").Value = rdbList5.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("INTENTION").Value = rdbList6.SelectedItem.Value
            Me.OleDbInsertCommand1.Parameters("FACTOR_COMM").Value = txtFactor_Comm.Text
            'Open the connection

Error Message:

No error information available: DB_E_ERRORSOCCURRED(0x80040E21).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: No error information available: DB_E_ERRORSOCCURRED(0x80040E21).

Source Error:

Line 535:            'Open the connection
Line 536:            Me.OleDbInsertCommand1.Connection.Open()
Line 537:            Me.OleDbInsertCommand1.ExecuteNonQuery()

Source File: c:\inetpub\wwwroot\gpform\gpform1_thai.aspx.vb    Line: 537

Stack Trace:
[OleDbException (0x80040e21): No error information available: DB_E_ERRORSOCCURRED(0x80040E21).]

[InvalidOperationException: Command parameter[2] 'RESPECT_COMM' data value could not be converted for reasons other than sign mismatch or data overflow.
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   gpform.gpform1_thai.btnSubmit_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\gpform\gpform1_thai.aspx.vb:537
   System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
Question by:disney71
    LVL 6

    Accepted Solution

    Maybe these documents can help, I myself have not experienced this scenario.


    Good Luck!
    LVL 6

    Expert Comment

    This seems to be the problem:

    'RESPECT_COMM' data value could not be converted for reasons other than sign mismatch or data overflow.

    what type is that field? and what did you put in txtRespect_Comm.Text?

    Author Comment

    RESPECT_COMM is a text box. We put in one Thai character to test it and this is the error. It is not a required field, but a comment field so it may or may not be filled out for each user.

    I am pretty sure it is the Thai character and OLE DB. Everything else works until we put in a Thai character.

    We can also use SQL Plus to insert Thai characters straight into Oracle so we are sure the Oracle instance is set up correctly.
    LVL 6

    Expert Comment

    No, txtRespect_Comm is the textbox. I was asking about RESPECT_COMM parameter. Anyway, try to escape charcaters. For example, single quotes could be repeated or backslashed.

    How does a typical Thai character look like?

    Author Comment

    Finally got some information. Microsoft's OLE DB driver was built to use Oracle 7, which does not support Unicode. We are using Oracle 9. It was suggested we use the Oracle OLE DB driver, which we are in the process of testing.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now