Creates a new record in the data source associated with the layer.


Namespace: AspMap
Assembly: AspMapNET (in AspMapNET.dll)

Syntax

Visual Basic (Declaration)
Public Function NewRecord() As Recordset
C#
public Recordset NewRecord()
C++
public:
 Recordset NewRecord() sealed 
J#
public Recordset NewRecord()
JScript
public  function NewRecord() : Recordset

Return Value

The method returns a Recordset object.

Exceptions

Exception TypeCondition
ExceptionThrown when an error occurs.

Remarks

This method supports spatial database layers derived from the SpatialDatabaseLayer.

To add a new record: 1) call the NewRecord method, 2) set field values in the Recordset and 3) call the Update method.

The coordinate system of the newly added shape will be set to the coordinate system of the layer.

Example

 Copy Code
SqlServerLayer sqlLayer = new SqlServerLayer(connString, "roads", "GEOMETRY");
layer.FieldList = "TYPE,NAME";
layer.DataType = SqlServerDataType.Geometry;

Layer layer = map.AddLayer(sqlLayer);

Recordset rs = layer.NewRecord();
rs["TYPE"] = "ramp";
rs["NAME"] = "Exit Ramp";
rs.Shape = new Polyline(new Point(x1,y1), new Point(x2,y2));
rs.Update();

See Also