OdbcDataAdapter Fill(Datatable) method throws System.Data.Odbc.OdbcException with empty exception message

无人久伴 提交于 2019-12-12 02:53:23

问题


I am using following c# code to query a Sybase database(driver - Adaptive Server Enterprise). -

    string query = “select * from view_Test”;
    DataTable dt = new DataTable();
    OdbcConnection con = new OdbcConnection();
    con.ConnectionString = connStr;
    OdbcCommand selectCommand = new OdbcCommand(query, con);
    OdbcDataAdapter dataAdatper = new OdbcDataAdapter(selectCommand);                   
    dataAdatper.Fill(dt);

dt is getting populated but at the same time this code is throwing following exception -

  System.Data.Odbc.OdbcException occurred
  HResult=-2146232009
  Message=""
  Source=""
  ErrorCode=-2146232009

if I select columns that do not have any null values or not Boolean, then the same code does not throw any exception.

But when I use DDTek.Sybase or Sybase.AdoNet4.AseClient dlls, the same code(class names are replaced by dll specific class names.eg, OdbcConnection is replaced by AseConnection) works.

Please help to resolve this issue

来源:https://stackoverflow.com/questions/36620615/odbcdataadapter-filldatatable-method-throws-system-data-odbc-odbcexception-wit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!