• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1458
  • Last Modified:

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

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)
  • 2
  • 2
1 Solution
Maybe these documents can help, I myself have not experienced this scenario.

1:) http://support.microsoft.com/default.aspx?scid=kb;en-us;294160
2:) http://support.microsoft.com/kb/312288

Good Luck!
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?
disney71Author Commented:
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.
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?
disney71Author Commented:
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.

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now