| Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - | 
			Contents
			Index
			![]()  
		 | 
	
| Part 1 The Basic for Developing Application | > Chapter 6 Direct Access Function | > 6.4 Searching Data by Direct Access Key | 
The SearchByKey method is used in the direct search for .NET API.
The following figure shows a flow of the direct search for .NET API.

Sample Code
ShunService service = new ShunService(); service.Connect(); ShunRecord record1 = new ShunRecord(); ShunRecord record2 = new ShunRecord(); ShunRecord record3= new ShunRecord(); record1.Key = "20061101,00000001"; (1) record2.Key = "20061101,00000002"; (1) record3.Key = "20061101,00000003"; (1) ShunKeyRequirement keyReq = new ShunKeyRequirement(); (2) keyReq.KeyName = "key1"; (3) keyReq.SearchType = ShunKeySearchType.CompleteMatch; (3) keyReq.Records.Add( record1 ); (3) keyReq.Records.Add( record2 ); (3) keyReq.Records.Add( record3 ); (3) ShunResultSet rs = service.SearchByKey( keyReq, "/" );                   (4)
Console.WriteLine( "[Number of results] = " + rs.ReturnCount );
foreach ( ShunRecord record in rs.Records ) {
  Console.WriteLine( "[Result] = " + record.Data );
}
service.Disconnect(); | 
(1) Set the Direct Access KeySet the direct access key at the ShunRecord object.
(2) Create a ShunKeyRequirement ObjectCreate a ShunKeyRequirement object.
(3) Set to the ShunKeyRequirement objectSet the direct access key name and the ShunRecord object to the ShunKeyRequirement object.

Specify multiple ShunRecord objects with the add method to obtain multiple XML documents at a time.
(4) Execute the Search (Create a ShunResultSet Object)Specify the return expression and ShunKeyRequirement object to the SearchByKey method and execute the search. A ShunResultSet object will be created to hold the results of the search.

Refer to the following sections for the sample programs of the direct access.
For C# .NET: G.3.2 Searching Data Using Direct Access Key
For VB .NET: H.3.2 Searching Data Using Direct Access Key
For C++ .NET: I.3.2 Searching Data Using Direct Access Key
			Contents
			Index
			![]()  
		 |