Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX -
Contents Index PreviousNext

Part 2 Developing Applications by APIs> Chapter 10 Developing .NET Applications> 10.3 How to Use .NET APIs> 10.3.3 Updating Data

10.3.3.1 Adding Data

Use the Insert method to add data.

The following diagram shows the process for adding data.

[Figure 10-13 Flow of the Process for Adding Data]

mark1Sample Code for C# .NET

ShunService service = new ShunService();
service.Connect();

String data = "<document>"
             +"    <base>"
                     :
             +"    </base>"
             +"    <information>"
                     :
             +"    </information>"
             +"</document>";

ShunRecordCollection recCol = new ShunRecordCollection();                       (1)
ShunRecord record = new ShunRecord( data );                                     (2)
recCol.Add( record );                                                           (3)

service.Insert( recCol );                                                       (4)

service.Disconnect();

mark1Sample Code for VB .NET

Dim service As New ShunService()
service.Connect()

Dim data As String = "<document>" _
                  &"    <base>" _
                          :
                  &"    </base>" _
                  &"    <information>" _
                          :
                  &"    </information>" _
                  &"</document>"


Dim recCol As New ShunRecordCollection()                                        (1)
Dim record As New ShunRecord( data )                                            (2)
recCol.Add( record )                                                            (3)

service.Insert( recCol )                                                        (4)

service.Disconnect()

mark2(1) Create a ShunRecordCollection Object

Create the ShunRecordCollection object.

mark2(2) Specify the Data to Add

Set the XML documents to be added at the ShunRecord object. Use the following methods to set the XML documents. Refer to the table below for the methods that can be used to add XML documents.

[Table 10-21 List of Methods for Setting XML Documents]

Method or property

Function

ShunRecord(String data)

Specifies XML documents to the arguments of the constructor and creates the ShunRecord object.

ShunRecord(Stream stream)

Specifies XML documents to the arguments of the constructor and creates the ShunRecord object.

Data property

Specifies the XML documents.

setData(Stream stream)

Specifies the XML documents.

mark2(3) Set the ShunRecord Object

Set the ShunRecord object at ShunRecordCollection object.

Use the following methods to set the ShunRecord object, Refer to the table below for the methods that can be used to add XML documents.

[Table 10-22 List of Methods for Setting ShunRecord Object]

Method or property

Function

Add(ShunRecord record)

Adds the ShunRecord to the end of ShunRecordCollection.

AddRange(ShunRecord[] records)

Copies the element of ShunRecord array to the end of ShunRecordCollection.

Insert(int index, ShunRecord record)

Inserts the ShunRecord at the index position specified in the ShunRecordCollection.

Item[int index]

Replaces the ShunRecord that the index position is specified.
This property will be the indexer of ShunRecordCollection class for C# .NET.

mark2(4) Add the Data

Use the Insert method to add the data.


Contents Index PreviousNext

All Rights Reserved, Copyright(C) FUJITSU LIMITED 2006