×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

请教个问题(.net+Oracle) 见内:

用OracleDataAdapter update dataset, code 如下:

DataSet ds_list = new DataSet();
OracleConnection Conn = new OracleConnection(CONN_STRING);
OracleDataAdapter da_mytable = new OracleDataAdapter();

string sql_mytable = "select * from mytable";

da_mytable.SelectCommand = new OracleCommand(sql_mytable, Conn);

OracleCommandBuilder cb_entity = new OracleCommandBuilder(da_entity);

Conn.Open();

da_mytable.Fill(ds_list, "mytable");

//modify data in ds_list.Tables["mytable"] with some French Character such as Montréal

da_mytable.Update(ds_list, "mytable");

Conn.Close();

问题:英文完全没问题,法文不行Montréal变成Montreal了,以前在SQL Server用过类似的code,没有问题,可能是Oracle与.Net dataadapter之间的兼容问题,有没有什么设置可以解决这个问题?

Thanks.
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / 请教个问题(.net+Oracle) 见内:
    用OracleDataAdapter update dataset, code 如下:

    DataSet ds_list = new DataSet();
    OracleConnection Conn = new OracleConnection(CONN_STRING);
    OracleDataAdapter da_mytable = new OracleDataAdapter();

    string sql_mytable = "select * from mytable";

    da_mytable.SelectCommand = new OracleCommand(sql_mytable, Conn);

    OracleCommandBuilder cb_entity = new OracleCommandBuilder(da_entity);

    Conn.Open();

    da_mytable.Fill(ds_list, "mytable");

    //modify data in ds_list.Tables["mytable"] with some French Character such as Montréal

    da_mytable.Update(ds_list, "mytable");

    Conn.Close();

    问题:英文完全没问题,法文不行Montréal变成Montreal了,以前在SQL Server用过类似的code,没有问题,可能是Oracle与.Net dataadapter之间的兼容问题,有没有什么设置可以解决这个问题?

    Thanks.
    • dataset 有一个property locale as system.globalization.cultureinfo,应该是做这个的。我自己没用过,你可以看.net help
    • check Oracle DB's NLS_LANG or CHARACTERSET. they should be either UTF-8 or WE8ISO8859P1. I used it before but kinds forgot the detail.
    • 是数据库里有问题还是数据库出来在外面用问题?
      • debug时,发现dataset里的数据是正确的,update以后用sql察看数据库的数据不正确,可能象是schen说的字符集问题,明天查一下我机器上的字符集先。