CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Threaded View

  1. #1
    Join Date
    Sep 2007
    Posts
    2

    Exclamation Read data using ODBC ADO.NET from Db2 Codepage 1252 - Euro (€) Symbol is not retrived

    In VS 2005 C#, While inserting Euro (€) Symbol into Db2 table, It is storing values correctly. DISABLEUNICODE=1 parameter of Db2 CLI setting helped to store this correctly.

    But when we try to read from the table, it is giving junk char as below.

    "Spec GS [] 12"

    Same code is working in VB 6.0 ADO

    Could you please help me. Should i specify anything in connection string to read correct value? Should i using any encoding logic?

    -------------------------------------------------------------------------------------------------------

    OdbcConnection con = new OdbcConnection();

    OdbcDataAdapter dataAdapter = new OdbcDataAdapter("SELECT * FROM XXXX.XXXX" , con);

    OdbcCommand odbcCommand =

    new OdbcCommand(

    "INSERT INTO XXXX.XXXX( BREACH_TYPE,JURISDICTION,ACTIVE ,VERIFIED , UPDATED_TS , UPDATED_BY ,VERIFIED_TS ,VERIFIED_BY)VALUES ('Spec GS € 1','IRE','Y','Y',CURRENT TIMESTAMP,'XECCRT3',CURRENT TIMESTAMP,'XECCRT8')");



    con.ConnectionString = "DSN=DSNT;UID=xxxxxxxx;PWD=xxxxxxxx;MODE=SHARE;DBALIAS=DSNT;DISABLEUNICODE=1;PATCH1=1024;LONGDATACOMPAT=1;LOBMAXCOLUMNSIZE=1048575;PATCH2=6;";

    con.Open();



    odbcCommand.Connection = con;

    odbcCommand.ExecuteNonQuery();



    dataAdapter.SelectCommand.CommandTimeout = 0;



    DataSet dataSet = new DataSet();

    dataAdapter.Fill(dataSet);

    DataTable result = dataSet.Tables[0];



    string Text = result.Rows[0][0].ToString();



    MessageBox.Show(Text = result.Rows[0][0].ToString());


    con.Close();
    -------------------------------------------------------------------------------------------------------
    Last edited by gunasekaranmohan; July 7th, 2010 at 04:36 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured