【发布时间】:2018-01-30 04:41:03
【问题描述】:
我有一个激活了 earthdistance 模块的 PostgreSQL 数据库。 我有一列数据类型设置为地球。 有没有办法使用 Npgsql 插入新记录? 我尝试使用 ll_to_earth(lat,long) 函数但收到错误 “installation_location\”是地球类型,但表达式是文本类型”
int din_id = 5;
using (var cmd = new NpgsqlCommand("INSERT INTO installation_test
(installation_id, installation_location ) " +
"VALUES (@uin_id, @uin_loc ) ", connection))
{
cmd.Parameters.AddWithValue("uin_id", din_id);
cmd.Parameters.AddWithValue("uin_loc",
"ll_to_earth(-23.482409,153.141043)");
cmd.ExecuteNonQuery();
}
谢谢
【问题讨论】:
标签: postgresql npgsql