System.NotSupportedException:Unsupported Oracle data type USERDEFINED encountered

原来是由于web service调用的oracle数据库的表结构中有oracle spatial字段,所以不能正确返回。

解决问题思路:纵向分解,横向对比。

通过与访问其他具有简单字段的表对比得出的结论。

—————————————————————————————————————————

  [WebMethod]  //返回dataset可以,但是返回datatable比较复杂 added by zhangjun at 2011-02-16

    public DataSet DoQueryEx(string sqlStr)

    {

        if (String.IsNullOrEmpty(sqlStr))

        {

            return null;

        }

        DataSet result = new DataSet();

        using (OracleConnection conn = new OracleConnection(_connStr))

        {

            try

            {

                if (conn.State == ConnectionState.Closed)

                {

                    conn.Open();

                }

                OracleDataAdapter adapter = new OracleDataAdapter(sqlStr, conn);

                adapter.Fill(result);  //既可以fill dataset,也可以fill datatable

                adapter.Dispose();

                return result;

            }

            catch (Exception ex)

            {

                throw ex;

            }

        }

    }

相关文章:

  • 2021-10-11
  • 2021-11-20
  • 2021-06-28
  • 2022-01-18
  • 2021-09-21
  • 2021-06-15
  • 2022-12-23
  • 2021-05-20
猜你喜欢
  • 2022-12-23
  • 2021-07-13
  • 2021-11-20
  • 2022-12-23
  • 2021-07-16
  • 2021-10-23
  • 2022-12-23
相关资源
相似解决方案