ADO: Insert Geometry Data to SQL DB

78 views Asked by At

Is there a posibility to insert Spatial Instances to SQLDB by using Parameters.

In my case I use TADOQuery (AQuery) with TADOConnection(AConnection). My Table consists of two columns Geom: geometry and ObjectName: varchar(50)

How can I correctly pass the geometry Instance as a parameter for my second case (with parameter).

THIS IS WORKING - WITHOUT PARAMETER

sqlString = "insert into obj ";
sqlString += (" (Geom,ObjectName) values('Point(2 2)', 'Point')");
AQuery->SQL->Text = sqlString;
AQuery->ExecSQL();

THIS IS NOT WORKING - WITH PARAMETER

sqlString = "insert into obj ";
sqlString += (" (Geom,ObjectName) values(:Geom, :ObjectName)");

AQuery->SQL->Text = sqlString;

AQuery->Parameters->ParamByName("Geom")->Value = "POINT (100 105)";
AQuery->Parameters->ParamByName("ObjectName")->Value = "Point";

AQuery->ExecSQL();
AQuery->Parameters->Clear();
AQuery->Close();
0

There are 0 answers