I working on a GIS application which uses the PostgreSQL database with PostGIS extension. I already created the data access logic for entire project and everything works fine except the geometry value insert.
I have to pass geometry value as a function call:
INSERT INTO mygeotable (id, name, geom) VALUES
(1, "MyName", ST_GeomFromText('POINT(755888.4156 112458.556)', 23700))
As you can see I have to call the ST_GeomFromText PostGIS function on INSERT
for the geom
column value. This geom
column is a string value from the view of ADO.NET but it can't be set as a text on INSERT
.
I think ADO.NET automatically formats my INSERT
command this way:
INSERT INTO mygeotable (id, name, geom) VALUES
(1, "MyName", "ST_GeomFromText('POINT(755888.4156 112458.556)', 23700)")
Which is wrong because of quotation marks!
How can I set INSERT
command's geom
parameter to use ST_GeomFromText
function call?
I use parameters for every column. InsertCommand CommandText is:
INSERT INTO mygeotable (id, name, geom) VALUES (id, name, geom)
The geom paramter DbType is String. There is no DbType for function call!