Click to See Complete Forum and Search --> : Read data using ODBC ADO.NET from Db2 Codepage 1252 - Euro (€) Symbol is not retrived


gunasekaranmohan
July 5th, 2010, 03:24 PM
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();
-------------------------------------------------------------------------------------------------------