我在postgresql中的值是UNKNOWN,但是我确定数据是否为Point,因为表名称是geometry,所以如何将其转换并返回json
我一直尝试使用字符串获取它,但返回值为“ NpgsqlTypes.PostgisPoint”,如果我将其返回为整数,则消息显示为“ System.InvalidCastException:'无法转换类型为'NpgsqlTypes.PostgisPoint'的对象键入“ System.IConvertible”。”
PointMaster point = new PointMaster
{
point_id = Convert.ToString(reader["point_id"]),
point_type = (string)reader["point_type"],
longitude = Convert.ToDouble(reader["longitude"]),
latitude = Convert.ToDouble(reader["latitude"]),
approval_Flag = Convert.ToString(reader["approval_Flag"]),
sp_geometry = Convert.ToInt32(reader["sp_geometry"]), <--- This is the problem
msid = Convert.ToInt32(reader["msid"]),
approval_date = Convert.ToString(reader["approval_date"]),
creator_remark = Convert.ToString(reader["creator_remark"]),
approver_remark = Convert.ToString(reader["approver_remark"]),
user_id = Convert.ToInt32(reader["user_id"]),
approver_id = Convert.ToInt32(reader["approver_id"]),
common_name = Convert.ToString(reader["common_name"]),
db_flag = Convert.ToInt32(reader["db_flag"])
};
类型数据是Point,所以我应该怎么做才能将其返回给json