You are on page 1of 63

Storing and Indexing Spatial Data

In P2P Systems

Abstract

In a Computer Network, The peer-to-peer (P2P) paradigm has become


very popular for loading and distributing information in separate manner that is from one
single system to another system. At first, TheP2P systems are very useful in sharing the
one dimensional information. But nowadays, the need for P2P applications with
multidimensional data has risen, inspiring research on P2P systems that can handle such
type of data. Now our focal point is on structured P2P systems that share spatial
information (partial) and also we have to found the area and directionality of the
multidimensional information. We present SPATIALP2P, is a totally and inherently
distributed P2P network and also a totally separate indexing and searching framework
that is suitable for spatial data. SPATIALP2P supports P2P applications in which spatial
information of various sizes can be dynamically edited, updated, and peers can leave or
join. SPATIALP2P efficiently handles changes in the spatial information and in the
network structure caused by joining or leaving peers without the need of load balancing
or restructuring. Finally, contrary to existing DHT-based approaches, SPATIALP2P
captures the locality and directionality of the 2D space.
Introduction
THE peer-to-peer (P2P) paradigm has become very popular for storing and sharing
information in a totally decentralized manner. Typically, a P2P system is a distributed
environment formed by autonomous peers that operate in an independent manner. Each
peer stores a part of the available information and maintains links (indexes) to other
peers. P2P systems provide a method to distribute the available information to peers.
They guarantee the retrieval of any information that exists in the system.P2P achieves a
reasonable index size for all peers and a reasonable search path for any search performed

in the system. This maintains a low cost for updating peer indexes when peers join or
leave and also achieves data and search load balancing,
Until recently, research has focused mostly on P2P systems that handle 1D data such as
strings and numbers. However, the need for P2P applications that manage
multidimensional data has emerged. These systems pose additional requirements that
stem from the particularities of such data. In centralized multidimensional applications,
information is stored according to its multidimensional extent using an indexing structure
Typically, these structures preserve the locality and the directionality of multidimensional
information. Intuitively, locality implies that neighboring multidimensional information
is stored in neighboring nodes, while directionality implies that the index structure
preserves orientation. The notions of locality and directionality are very important. If an
index structure preserves these properties then searching in the index corresponds to
searching in the multidimensional space which can highly improve query evaluation cost.
In the literature, there exist two different paradigms for handling multidimensional data in
P2P systems. The first paradigm proposes the use of a distributed version of some
centralized multidimensional index. The main challenge of these approaches is to avoid
the bottleneck occurring at the peer storing the root of the tree (since every search has to
pass through this peer). The work in alleviates the traffic burden of the root by initiating
the search at a pre specified level below the root. Moreover, the work in proposes
sideway index links that help to avoid searching the index from the root
1.1 PROJECT DESCRIPTION:

The project entitled as Active Learning Methods for Interactive Image Retrieval
developed using .NET using C#. Modules display as follows
1. Connecting Peer
2. Successors and Indexed Peer
3. Data Storing

4. Individual and Neighbor Search


5. Display Result

Module Description
Connecting Peer
All the peers are connected here to form a LAN. Many nodes can connect in a LAN.LAN
is the collection of systems, a network. In this module, connecting al the system from a
remote machine and sharing the resources. This module helps to see how many systems
are connected and to know shared resources.
Successors and Indexed Peer
Successors assure that there is always a path between two arbitrary peers in the network.
a search that is entirely based on successors is not efficient since it may result in long
search paths. To speed up searching, a peer also stores the location of additional peers.
Such peers are called indexed peers.
Data Storing
Data of a same object or related data can store from various peers. This makes easy of
data storage in peer to peer systems.

Individual and Neighbor Search


Successors preserve the locality and the directionality of the 2D space in the P2P
network. They guarantee the connectivity of the network. . To speed up searching, a peer
also stores the location of additional peers, searching in indexed peers also.
Display Result
Here, needed data is getting from all the peers and send to the particular node which
needs it currently. All the related data from various systems are searching and collecting
in previous modules and showing the result

2. SYSTEM STUDY
2.1 FEASIBILITY STUDY
The feasibility of the project is analyzed in this phase and business proposal is put
forth with a very general plan for the project and some cost estimates. During system
analysis the feasibility study of the proposed system is to be carried out. This is to ensure
that the proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential.
Three key considerations involved in the feasibility analysis are

ECONOMICAL FEASIBILITY

TECHNICAL FEASIBILITY

SOCIAL FEASIBILITY

ECONOMICAL FEASIBILITY
This study is carried out to check the economic impact that the system will have on the
organization. The amount of fund that the company can pour into the research and
development of the system is limited. The expenditures must be justified. Thus the
developed system as well within the budget and this was achieved because most of the
technologies used are freely available. Only the customized products had to be purchased.
TECHNICAL FEASIBILITY

This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high demand on the
available technical resources. This will lead to high demands on the available technical
resources. This will lead to high demands being placed on the client. The developed
system must have a modest requirement, as only minimal or null changes are required for
implementing this system.
SOCIAL FEASIBILITY
The aspect of study is to check the level of acceptance of the system by the user.
This includes the process of training the user to use the system efficiently. The user must
not feel threatened by the system, instead must accept it as a necessity. The level of
acceptance by the users solely depends on the methods that are employed to educate the
user about the system and to make him familiar with it. His level of confidence must be
raised so that he is also able to make some constructive criticism, which is welcomed, as
he is the final user of the system.
Existing System
SPATIALP2P distributes the spatial information to peers and guarantees the retrieval of
any spatial area that exists in the system with low space and time complexity. These
Systems can handle only 1D data such as strings and numbers. Storing and sharing the
spatial information in a centralized manner. The locality and directionality of the spatial
data is very tough and we cant partition the space and define the appropriate distance.
There is no sideway index links that help to avoid searching the index from the root. So
there is waste of time in searching from the beginning to the end and there is no proper
structure to get the spatial data.
Disadvantages:

We cant able to calculate the distance between two cells for the
multidimensional and spatial data.

The peer p that cant update its index list initiates individual searches for
each index entry.

There is no proper load balancing .so peers overloaded with stored data
and there is no traffic bottleneck in the network.

Proposed System
The Proposed System uses two techniques in the first category are based on the
idea that 1D index can be reused in order to manage multidimensional data, if the
dimensionality is reduced to one. This idea was the first to be explored. Techniques in the
second category are based on the idea that centralized hierarchical indexes can be reused
to manage dispersed multidimensional data, if they are properly distributed. . Finally,
contrary to existing DHT-based approaches, SPATIALP2P captures the locality and
directionality of the 2D space. In this network we can partition the space and define the
appropriate distance. It achieve data and search load balancing, i.e., there are no peers
overloaded with stored data and there are no traffic bottleneck in the network.
Advantages:
1. Using an indexing structure (e.g., R-tree). Typically, these structures preserve the
locality and the directionality of multidimensional information.
2. We can avoid the traffic of data by using index searching. The peer p that can
update its index list initiates individual searches for each index entry.

3. SYSTEM SPECIFICATION

Hardware Requirements

SYSTEM

: Pentium IV 2.4 GHz

HARD DISK

: 40 GB

FLOPPY DRIVE

: 1.44 MB

MONITOR

: 15 VGA colour

MOUSE

: Logitech.

RAM

: 256 MB

KEYBOARD : 110 keys enhanced.

Software Requirements

Operating system

:- Windows XP Professional

Front End

:- Microsoft Visual Studio .Net 2008

Coding Language

:- ASP.NET 3.5, C# 2.0

Database

:- SQL SERVER 2005

4. LANGAUGE SPECIFICATION
4.1 features OF. net
Microsoft .NET is a set of Microsoft software technologies for rapidly building and
integrating XML Web services, Microsoft Windows-based applications, and Web
solutions. The .NET Framework is a language-neutral platform for writing programs that
can easily and securely interoperate. Theres no language barrier with .NET: there are
numerous languages available to the developer including Managed C++, C#, Visual Basic
and Java Script. The .NET framework provides the foundation for components to interact
seamlessly, whether locally or remotely on different platforms. It standardizes common
data types and communications protocols so that components created in different
languages can easily interoperate.
.NET is also the collective name given to various software components built upon
the .NET platform. These will be both products (Visual Studio.NET and Windows.NET
Server, for instance) and services (like Passport, .NET My Services, and so on).

THE .NET FRAMEWORK


The .NET Framework has two main parts:
1. The Common Language Runtime (CLR).
2. A hierarchical set of class libraries.
The CLR is described as the execution engine of .NET. It provides the environment
within which programs run. The most important features are

Conversion

from

low-level

assembler-style

language,

called

Intermediate Language (IL), into code native to the platform being


executed on.

Memory management, notably including garbage collection.

Checking and enforcing security restrictions on the running code.

Loading and executing programs, with version control and other such
features.

The following features of the .NET framework are also worth description:

Managed Code
The code that targets .NET, and which contains certain extra
Information - metadata - to describe itself. Whilst both managed and unmanaged code
can run in the runtime, only managed code contains the information that allows the CLR
to guarantee, for instance, safe execution and interoperability.
Managed Data
With Managed Code comes Managed Data. CLR provides memory allocation and Deal
location facilities, and garbage collection. Some .NET languages use Managed Data by
default, such as C#, Visual Basic.NET and JScript.NET, whereas others, namely C++, do
not. Targeting CLR can, depending on the language youre using, impose certain
constraints on the features available. As with managed and unmanaged code, one can
have both managed and unmanaged data in .NET applications - data that doesnt get
garbage collected but instead is looked after by unmanaged code.

Common Type System


The CLR uses something called the Common Type System (CTS) to strictly enforce
type-safety. This ensures that all classes are compatible with each other, by describing
types in a common way. CTS define how types work within the runtime, which enables
types in one language to interoperate with types in another language, including crosslanguage exception handling. As well as ensuring that types are only used in appropriate
ways, the runtime also ensures that code doesnt attempt to access memory that hasnt
been allocated to it.

Common Language Specification


The CLR provides built-in support for language interoperability. To ensure that you can
develop managed code that can be fully used by developers using any programming
language, a set of language features and rules for using them called the Common
Language Specification (CLS) has been defined. Components that follow these rules and
expose only CLS features are considered CLS-compliant.

THE CLASS LIBRARY


.NET provides a single-rooted hierarchy of classes, containing over 7000 types. The root
of the namespace is called System; this contains basic types like Byte, Double, Boolean,
and String, as well as Object. All objects derive from System. Object. As well as objects,
there are value types. Value types can be allocated on the stack, which can provide useful
flexibility. There are also efficient means of converting value types to object types if and
when necessary.
The set of classes is pretty comprehensive, providing collections, file, screen, and
network I/O, threading, and so on, as well as XML and database connectivity.
The class library is subdivided into a number of sets (or namespaces), each providing
distinct areas of functionality, with dependencies between the namespaces kept to a
minimum.

LANGUAGES SUPPORTED BY .NET


The multi-language capability of the .NET Framework and Visual Studio .NET enables
developers to use their existing programming skills to build all types of applications and

XML Web services. The .NET framework supports new versions of Microsofts old
favorites Visual Basic and C++ (as VB.NET and Managed C++), but there are also a
number of new additions to the family.
Visual Basic .NET has been updated to include many new and improved language
features that make it a powerful object-oriented programming language. These features
include inheritance, interfaces, and overloading, among others. Visual Basic also now
supports structured exception handling, custom attributes and also supports multithreading.
Visual Basic .NET is also CLS compliant, which means that any CLS-compliant
language can use the classes, objects, and components you create in Visual Basic .NET.
Managed Extensions for C++ and attributed programming are just some of the
enhancements made to the C++ language. Managed Extensions simplify the task of
migrating existing C++ applications to the new .NET Framework.
C# is Microsofts new language. Its a C-style language that is essentially C++ for Rapid
Application Development. Unlike other languages, its specification is just the grammar
of the language. It has no standard library of its own, and instead has been designed with
the intention of using the .NET libraries as its own.

Microsoft Visual J# .NET provides the easiest transition for Java-language developers
into the world of XML Web Services and dramatically improves the interoperability of
Java-language programs with existing software written in a variety of other programming
languages.
Active State has created Visual Perl and Visual Python, which enable .NET-aware
applications to be built in either Perl or Python. Both products can be integrated into the
Visual Studio .NET environment. Visual Perl includes support for Active States Perl Dev
Kit.

Other languages for which .NET compilers are available include

FORTRAN

COBOL

Eiffel

Fig1 .Net Framework


ASP.NET

Windows Forms

XML WEB SERVICES


Base Class Libraries
Common Language Runtime
Operating System

C#.NET is also compliant with CLS (Common Language Specification) and supports
structured exception handling. CLS is set of rules and constructs that are supported by the
CLR (Common Language Runtime). CLR is the runtime environment provided by the
.NET Framework; it manages the execution of the code and also makes the development
process easier by providing services.
C#.NET is a CLS-compliant language. Any objects, classes, or components that created
in C#.NET can be used in any other CLS-compliant language. In addition, we can use
objects, classes, and components created in other CLS-compliant languages in C#.NET

.The use of CLS ensures complete interoperability among applications, regardless of the
languages used to create the application.
CONSTRUCTORS AND DESTRUCTORS:
Constructors are used to initialize objects, whereas destructors are used to
destroy them. In other words, destructors are used to release the resources allocated to the
object. In C#.NET the sub finalize procedure is available. The sub finalize procedure is
used to complete the tasks that must be performed when an object is destroyed. The sub
finalize procedure is called automatically when an object is destroyed. In addition, the
sub finalize procedure can be called only from the class it belongs to or from derived
classes.
GARBAGE COLLECTION
Garbage Collection is another new feature in C#.NET. The .NET Framework monitors
allocated resources, such as objects and variables. In addition, the .NET Framework
automatically releases memory for reuse by destroying objects that are no longer in use.
In C#.NET, the garbage collector checks for the objects that are not currently in use by
applications. When the garbage collector comes across an object that is marked for
garbage collection, it releases the memory occupied by the object.
OVERLOADING
Overloading is another feature in C#. Overloading enables us to define multiple
procedures with the same name, where each procedure has a different set of arguments.
Besides using overloading for procedures, we can use it for constructors and properties in
a class.

MULTITHREADING:
C#.NET also supports multithreading. An application that supports multithreading can
handle multiple tasks simultaneously, we can use multithreading to decrease the time
taken by an application to respond to user interaction.
STRUCTURED EXCEPTION HANDLING
C#.NET supports structured handling, which enables us to detect and
remove errors at runtime. In C#.NET, we need to use TryCatchFinally statements to

create exception handlers. Using TryCatchFinally statements, we can create robust


and effective exception handlers to improve the performance of our application.
THE .NET FRAMEWORK
The .NET Framework is a new computing platform that simplifies application
development in the highly distributed environment of the Internet.
Objectives of. NET FRAMEWORK
1. To provide a consistent object-oriented programming environment whether object
codes is stored and executed locally on Internet-distributed, or executed remotely.
2. To provide a code-execution environment to minimizes software deployment and
guarantees safe execution of code.
3. Eliminates the performance problems.
There are different types of application, such as Windows-based applications and WebSTART
based applications.

5. SYSTEM DESIGN

CONNECT PEER

SUCCESSOR AND
INDEXED PEER

Module Diagram

DATA STORING

SEARCH & RESULT

STOP

UML Diagrams
Use case diagram

Successor Peer

ADMIN

Search data

Full Connection

Indexed Peer

Class diagram

PEER
PeerID
Filename
Succesor
Indexed

SearchFile
Filenames
Peername
search()

Peer()

Indexed Peer
index_name
suc_name
peer_list

Successor
suc_name
suc_pair

find()
refresh()

Refresh()

Object diagram

Login

Peer Collection

Search
Successor

Access File

State diagram

Search
Indexers

Collection Successor
Peer Indexer

LAN

Search

Activity diagram

Retrive
Data

Successor

Search
Connection Of
peer
Access

Login

Successor

Show Data

Sequence diagram

USER

SUCCESSOR

ACCESS COLLECTION
DATA
COMBINE

OUTPUT

NEIGHBORS

SEARCH SYSTEM

DATA

RELATED DATA

Collaboration Diagram

Component Diagram

Successor

Data
Collection

ADMIN

USER

Indexer

Search Data

User

1: Neighbors

E-R diagram
OUTPUT

Successor
DATA

4: Related Data

2: Search System

HAS

LAN
3: Data
Access
Data

Collection
Combine

PEERS

PEER
HAS
SUCCESSO
R

COLLECTI
ON DATA
INDEXER

ADMIN
CONTROL
LAN
USERNA
ME

PASSWORD

Dataflow diagram

USER

Connect Peer

Search
Peer

Collect Related
Data

Show
Output

Data

Project Flow Diagram

User

Connect
Network

Stop

Store Data

Result
Combination

Search Data

Collection of
Data

System Architecture

USER

PEER
COLLECTION
SUCCESSOR

INDEXER

STORE
ACESS
DATA

SEARCH

6. SYSTEM TESTING AND MAINTENANCE


Testing is vital to the success of the system. System testing makes a logical assumption
that if all parts of the system are correct, the goal will be successfully achieved. In the
testing process we test the actual system in an organization and gather errors from the
new system operates in full efficiency as stated. System testing is the stage of
implementation, which is aimed to ensuring that the system works accurately and
efficiently.
In the testing process we test the actual system in an organization and gather errors from
the new system and take initiatives to correct the same. All the front-end and back-end
connectivity are tested to be sure that the new system operates in full efficiency as stated.
System testing is the stage of implementation, which is aimed at ensuring that the system
works accurately and efficiently.
The main objective of testing is to uncover errors from the system. For the uncovering
process we have to give proper input data to the system. So we should have more
conscious to give input data. It is important to give correct inputs to efficient testing.
Testing is done for each module. After testing all the modules, the modules are
integrated and testing of the final system is done with the test data, specially designed to
show that the system will operate successfully in all its aspects conditions. Thus the
system testing is a confirmation that all is correct and an opportunity to show the user that
the system works. Inadequate testing or non-testing leads to errors that may appear few
months later.
This will create two problems
Time delay between the cause and appearance of the problem. The effect of the system
errors on files and records within the system.
The purpose of the system testing is to consider all the likely variations to which it will
be suggested and push the system to its limits.
The testing process focuses on logical intervals of the software ensuring that all the
statements have been tested and on the function intervals (i.e.,) conducting tests to
uncover errors and ensure that defined inputs will produce actual results that agree with

the required results. Testing has to be done using the two common steps Unit testing and
Integration testing. In the project system testing is made as follows:
The procedure level testing is made first. By giving improper inputs, the errors occurred
are noted and eliminated. This is the final step in system life cycle. Here we implement
the tested error-free system into real-life environment and make necessary changes,
which runs in an online fashion. Here system maintenance is done every months or year
based on company policies, and is checked for errors like runtime errors, long run errors
and other maintenances like table verification and reports.
6.1. UNIT TESTING
Unit testing verification efforts on the smallest unit of software design, module.
This is known as Module Testing. The modules are tested separately. This testing is
carried out during programming stage itself. In these testing steps, each module is found
to be working satisfactorily as regard to the expected output from the module.
6.2. INTEGRATION TESTING
Integration testing is a systematic technique for constructing tests to uncover error
associated within the interface. In the project, all the modules are combined and then the
entire programmer is tested as a whole. In the integration-testing step, all the error
uncovered is corrected for the next testing steps.
7. SYSTEM IMPLEMENTATION
Implementation is the stage of the project when the theoretical design is turned out
into a working system. Thus it can be considered to be the most critical stage in achieving
a successful new system and in giving the user, confidence that the new system will work
and be effective.
The implementation stage involves careful planning, investigation of the existing
system and its constraints on implementation, designing of methods to achieve
changeover and evaluation of changeover methods.
Implementation is the process of converting a new system design into operation. It is
the phase that focuses on user training, site preparation and file conversion for installing a

candidate system. The important factor that should be considered here is that the
conversion should not disrupt the functioning of the organization

Future Enhancements
This project addresses some technical challenges, i.e.,Locality Preserving Function, query
and update routing protocols, and cluster-preserving load balancing. A high level of
object clustering is achieved by using the LPF on top of the existing DHTs without
requiring much change to the DHTs. Efficient query and update routing protocols
maximize the benefit of object clustering by significantly reducing the number of DHT
lookups. The load balancing schemes well distribute loads among peer nodes while
preserving the clustering property.
In the future, want to solve the challenges and intend to adjust and test the SPATIALP2P
framework for data of higher dimensions.

Advantages

3. Using an indexing structure (e.g., R-tree). Typically, these


structures preserve the locality and the directionality of
multidimensional information.
4. We can avoid the traffic of data by using index searching. The
peer p that can update its index list initiates individual searches
for each index entry.

Conclusion
Research in P2P systems has recently expanded in the domain of multidimensional data.
The techniques that have been proposed until now belong to two broad categories.
Techniques in the first category are based on the idea that 1D indexes can be reused in
order to manage multidimensional data, if the dimensionality is reduced to one. This idea
was the first to be explored. Techniques in the second category are based on the idea that
centralized hierarchical indexes can be reused to manage dispersed multidimensional
data, if they are properly distributed. More elaborated solutions have been proposed in
this category. However, the reusage of existing techniques in the approaches in both

categories leads to the maintenance of some fundamental features that oppose to the
nature of either the distributedness or the multidimensionality. Our intention is to
overcome these shortcomings by creating a technique that manages disperse
multidimensional data in an inherently distributed way without altering the
dimensionality.
Literature Survey
Peer-to-Peer Spatial Queries in Sensor Networks
With the recent advancements in micro-electromechanical- systems (MEMS) related
technology, it has now become feasible to manufacture low power sensors that integrate
detection of infrared radiation, heat, sound, vibration, and magnetism together with onchip intelligence and wireless communication. Progress in this area is significant for its
applications in deploying large ad-hoc wireless sensor networks (potentially consisting of
several thousands of nodes) to retrieve spatial information about an area of interest.
Sensor networks find applications in ecology (e.g., environmental and habitat
monitoring])in precision agriculture (e.g., monitoring of temperature and humidity), in
civil engineering (e.g., monitoring stress levels of buildings under earthquake
simulations), in military and surveillance (e.g., tracking of an intruder), in aerospace
industry (e.g., fairing of cargo in a rocket).
Here, focuses on efficient execution of spatial queries in sensor networks. In particular,
we are concerned with efficient execution of nearest neighbor (NN) queries in sensor
networks: What is the location of the nearest data object to coordinates. The query can
be initiated locally, without the need of a central server. The coordinates given in the
query can be either the current location of the user or a distant location of interest.
Skip Index: Towards a Scalable Peer-to-Peer Index Service for High Dimensional
Data

Indexing of high-dimensional data is essential for building applications such as


multimedia retrieval, data mining, and spatial databases. Traditional index structures rely
on centralized processing. This approach does not scale with the rapidly increasing
amount of application data available on massively distributed systems like the Internet.
Proposes distributed high-dimensional index structure based on peer-to-peer overlay
routing. A new routing scheme is used to lookup data keys in the distributed index, which
guarantees logarithmic lookup and maintenance cost, even in the face of skewed datasets.
A novel nearest neighbor (NN) query scheme can substantially reduce search cost by
sacrificing a small amount of precision. Here, a load-balancing mechanism that partitions
the high dimensional search space in a balanced manner. Then analyze the performance
of our proposed system using a variety of metrics with simulation as well as a functional
Planet Lab implementation.
CISS: An efficient object clustering framework for DHT-based peer-to-peer
applications
Distributed Hash Tables (DHTs) have been receiving a lot of attention as a scalable and
efficient infrastructure for Internet-scale data management. DHT organizes highly
distributed and loosely coupled peer nodes into a peer-to peer network. Such a P2P
network makes it possible for users to store and query over a massive number of objects.
DHT has already been adopted in many P2P systems including wide-area file systems
and Internet-scale query processors. These DHT-based systems efficiently support basic
access operations such as Put (key, object) and Get (key), and thus simple P2P
applications can be developed easily with such basic operations.
However, many emerging P2P applications require advanced access operations such as
Multi-dimensional range queries, continuous updates, similarity searches, aggregation,
etc, which access a set of semantically related objects in parallel or in sequence, rather
than performing separate accesses for individual objects. As an example, consider
massively multiplayer online games (MMOGs). Each player continuously queries the

game status of nearby players in a virtual world, which can be treated as multidimensional range queries. These range queries access a set of closely located players in
parallel. Meanwhile, streams of updates such as players locations and status are
intensively generated. Due to players continuous movements in the virtual world, a
sequence of successive updates is semantically close. Similar situations occur in P2P
auctions. They also intensively generate a high number of range queries and updates
which access highly related objects over multiple attributes, e.g., interest area queries.
M-LIGHT: Indexing Multi-Dimensional Data over DHTs
Distributed Hash Table (DHT) provides a scalable, load balanced, and robust substrate in
building large-scale distributed applications. Whereas simple lookup operations can be
efficiently executed over DHTs, they lack support for complex queries such as range
queries and similarity queries, which are however popular in many P2P applications (e.g.,
finding the songs that are rated above 4 and published during 2007 and 2008). The
reason is that data locality, which is crucial to processing such complex queries, is
destroyed by uniform hashing employed in DHTs.
In the literature, there are two indexing approaches to support complex queries in P2P
systems: 1) over- DHT indexing paradigm which builds an add-on index module over
generic DHTs; 2) DHT-dependent indexing paradigm which modifies the internal
structures of underlying DHTs or develops novel locality-preserved overlays (e.g., Skip
graphs. Although the over-DHT indexing approach is generally less efficient in query
performance than the DHT-dependent indexing approach, it excels in many other aspects
such as simplicity of deployment/ implementation/maintenance and inherited load
balancing. These issues could be particularly important in practice, for example, if one
wants to deploy P2P applications in the world-wide OpenDHT project.
We study the problem of how to efficiently support multi-dimensional range queries in
existing DHTbased P2P systems and thus advocate the over-DHT indexing paradigm. We
propose a novel over-DHT index called m-LIGHT (multi-dimensional Lightweight Hash
Tree over a DHT). Particularly, we investigate the following problems: 1) how to map a

tree-based index into the underlying DHT to better support distributed query processing;
and 2) how to perform index maintenance to better balance the loads of peer nodes. We
consider multi-dimensional data and employ a space-partition based kd-tree to index data.
To distribute the kd-tree over a DHT, we propose a tree-decomposition strategy that
enlarges the local view on each peer yet requires no extra maintenance overhead. We
further propose a novel multi-dimensional naming mechanism to gracefully map the
decomposed tree into the DHT. The naming mechanism possesses several nice properties
that lead to high efficiency in both index maintenance and query processing. Moreover, to
address the load balancing issue in space-partition based indexes, we propose a dataaware index splitting strategy to achieve optimal load balance among peer nodes.
References
F. Banaei-Kashani and C. Shahabi, SWAM: A Family of Access Methods for
Similarity-Search in Peer-to-Peer Data Networks, Proc. 13th ACM Intl Conf.
Information and Knowledge Management (CIKM 04), pp. 304-313, 2004.
A. Bharambe, M. Agrawal, and S. Seshan, MERCURY: Supporting Scalable
Multi-Attribute Range Queries, Proc. ACM SIGCOMM 04, pp. 353-366, 2004.
M. Cai, M. Frank, J. Chen, and P. Szekely, MAAN: A Multiattribute Addressable
Network for Grid Information Services, Proc. Fourth Intl Workshop Grid
Computing (GRID 03), pp. 184-191, 2003.
W. Cai, S. Zhou, L. Xu, W. Qian, and A. Zhou, c2: A New Overlay Network
Based on CAN and Chord, Proc. Intl Conf. Grid and Cooperative Computing
(GCC 03), pp. 42-50, 2003.

APPENDIX
SCREEN SHOTS

using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;

namespace spatial
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)

{
}
}

conpeer pe = new conpeer();


pe.Show();

using
using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
System.Threading;

namespace spatial
{
public partial class conpeer : Form
{
string [] pcn = new string[100];
public int no = 0;
Label[] sen = new Label[100];
int m = 1, j = 1;
public conpeer()
{
InitializeComponent();
}

private void conpeer_Load(object sender, EventArgs e)


{

}
private void button1_Click(object sender, EventArgs e)
{

try
{
NetworkBrowser nb = new NetworkBrowser();
foreach (string pc in nb.getNetworkComputers())
{
pcn[no] = pc;
Thread.Sleep(100);
progressBar1.Value = progressBar1.Value + 2;
no++;
}
while (progressBar1.Value < 100)
{
Thread.Sleep(100);
progressBar1.Value = progressBar1.Value + 2;
}
}
catch (Exception ex)
{
MessageBox.Show("error");
Application.Exit();
}
for (int i = 0; i < no; i++)
{
sen[i] = new Label();
sen[i].Name = pcn[i];
sen[i].Size = new Size(60, 30);
sen[i].Location = new Point(j * 170, m * 70);
sen[i].BackColor = Color.Transparent;
j++;
sen[i].Font = new System.Drawing.Font("Palatino
Linotype", 9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
sen[i].ForeColor = Color.LightGreen;
sen[i].Text = pcn[i];
panel1.Controls.Add(sen[i]);

if (i == 5 || i == 11 || i == 17 || i == 23 || i == 29
|| i == 35 || i == 41 || i == 47 || i == 53 || i == 59 || i == 65)
{
j = 1; m = m + 1;
}
}

}
private void linkLabel1_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
success su = new success();
su.no = no;
su.pcn = pcn;
su.Show();
}
}

using
using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
System.Drawing.Drawing2D;

namespace spatial
{
public partial class success : Form
{
public int no;
public string[] pcn = new string[100];
int lx = 1100, ly = 100, lz = 1155, lw = 120;
int i = 0, j = 0;
int f2 = 0, f3 = 0;
int lbx = 140, lby = 90;
Label[] sen = new Label[200];
Label[] suc = new Label[200];
int nosuc = 0; int nosen = 0;
public success()
{
InitializeComponent();
}
private void success_Load(object sender, EventArgs e)
{

}
private void button1_Click(object sender, EventArgs e)
{
Pen p = new Pen(Color.Black, 1);
Graphics f = panel1.CreateGraphics();

Pen myPen = new Pen(Color.Green);


Graphics formGraphics = panel1.CreateGraphics();

for (i = 1; i < 4; i++)


{
lx = lx - 900; lz = lz - 900;
for (j = 1; j < 4; j++)
{
if (i == 3)
{
if (f3 == 0)
{
ly = ly +
f3 = 1;
}
f.DrawLine(p,
f.DrawLine(p,
f.DrawLine(p,
f.DrawLine(p,
80);

100 + 100, 80, 80);

150; lw = lw + 150;
lx, ly, lz, lw);
lx, ly + 80, lz, lw + 40);
lx + 125, lw, lz + 125, ly);
lx + 125, lw + 40, lz + 125, ly +

lx = lx + 300; lz = lz + 300;
if (j == 1)
{
formGraphics.DrawEllipse(myPen, j * 250, i *

sen[nosen] = new Label();


sen[nosen].Name = ""; sen[nosen].BackColor =
Color.Transparent; sen[nosen].BackColor = Color.Transparent;
sen[nosen].Size = new Size(60, 30);
sen[nosen].Location = new Point(j*250+5,
i*100+100+25);
sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0; k < 4; k++)
{
int x = lbx; int y = lby+290;
if (k == 1)
y = y + 90;
if (k == 2)
x = x + 240;
if (k == 3)
{
x = x + 240; y = y + 90;
}

suc[nosuc] = new Label();


suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}
}
else if (j == 3)
{
formGraphics.DrawEllipse(myPen, j * 250 +
100, i * 100 + 100, 80, 80);
sen[nosen] = new Label();
sen[nosen].Name = ""; sen[nosen].BackColor =
Color.Transparent;

sen[nosen].Size = new Size(60, 30);


sen[nosen].Location = new Point(j * 250 +
100 + 5, i * 100 + 100 + 25);
sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0; k < 4; k++)
{
int x = lbx + 600; int y = lby + 290;
if (k == 1)
y = y + 90;
if (k == 2)
x = x + 240;
if (k == 3)
{
x = x + 240; y = y + 90;
}
suc[nosuc] = new Label();
suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";

panel1.Controls.Add(suc[nosuc]);
nosuc++;
}

}
else
{

formGraphics.DrawEllipse(myPen, j * 250 +

50, i * 100 + 100, 80, 80);

sen[nosen] = new Label();


sen[nosen].Name = ""; sen[nosen].BackColor =
Color.Transparent;
+ 5, i * 100 + 100 + 25);

sen[nosen].Size = new Size(60, 30);


sen[nosen].Location = new Point(j * 250 + 50

sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0; k < 4; k++)
{
int x = lbx + 300; int y = lby+290;
if (k == 1)
y = y + 90;
if (k == 2)
x = x + 240;
if (k == 3)
{
x = x + 240; y = y + 90;
}
suc[nosuc] = new Label();
suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}
}
}

else if (i == 2)
{
if (f2 == 0)
{
ly = ly +
f2 = 1;
}
f.DrawLine(p,
f.DrawLine(p,
f.DrawLine(p,
f.DrawLine(p,
80);

150; lw = lw + 150;
lx, ly, lz, lw);
lx, ly + 80, lz, lw + 40);
lx + 125, lw, lz + 125, ly);
lx + 125, lw + 40, lz + 125, ly +

lx = lx + 300; lz = lz + 300;
if (j == 1)
{
formGraphics.DrawEllipse(myPen, j * 250, i *

100 + 50, 80, 80);


sen[nosen] = new Label();
sen[nosen].Name = ""; sen[nosen].BackColor =
Color.Transparent;
i * 100 + 50+ 25);

sen[nosen].Size = new Size(60, 30);


sen[nosen].Location = new Point(j * 250 + 5,

sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0; k < 4; k++)
{
int x = lbx; int y = lby + 135;
if (k == 1)
y = y + 90;
if (k == 2)
x = x + 240;
if (k == 3)
{
x = x + 240; y = y + 90;
}
suc[nosuc] = new Label();
suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);

suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}
}
else if (j == 3)
{
formGraphics.DrawEllipse(myPen, j * 250 +
100, i * 100 + 50, 80, 80);
sen[nosen] = new Label();
sen[nosen].Name = ""; sen[nosen].BackColor =
Color.Transparent;

sen[nosen].Size = new Size(60, 30);


sen[nosen].Location = new Point(j * 250 +

100 + 5, i * 100 + 50 + 25);

sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0;
{
int x = lbx
if (k == 1)
y = y +
if (k == 2)
x = x +
if (k == 3)
{
x = x +
}

k < 4; k++)
+ 600; int y = lby+135;
90;
240;
240; y = y + 90;

suc[nosuc] = new Label();


suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}

}
else
{

formGraphics.DrawEllipse(myPen, j * 250 +

50, i * 100 + 50, 80, 80);


sen[nosen] = new Label();
sen[nosen].Name = ""; sen[nosen].BackColor =
Color.Transparent;

sen[nosen].Size = new Size(60, 30);


sen[nosen].Location = new Point(j * 250 + 50

+ 5, i * 100 + 50 + 25);

sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0;
{
int x = lbx
if (k == 1)
y = y +
if (k == 2)
x = x +
if (k == 3)
{
x = x +
}

k < 4; k++)
+ 300; int y = lby+135;
90;
240;
240; y = y + 90;

suc[nosuc] = new Label();


suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}
}
}

else if (i == 1)
{
lw);

f.DrawLine(p, lx, ly, lz,

f.DrawLine(p, lx, ly+80, lz, lw+40);


f.DrawLine(p, lx+125, lw, lz+125, ly);
f.DrawLine(p, lx + 125, lw+40, lz + 125, ly+80);
lx = lx + 300; lz = lz + 300;
if (j == 1)
{
formGraphics.DrawEllipse(myPen, j * 250, i *

100, 80, 80);


sen[nosen] = new Label();
sen[nosen].Name = ""; sen[nosen].BackColor =
Color.Transparent;
i * 100 + 25);

sen[nosen].Size = new Size(60, 30);


sen[nosen].Location = new Point(j * 250 + 5,

sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0; k < 4; k++)
{
int x = lbx; int y = lby;
if (k == 1)
y = y + 90;
if (k == 2)
x = x + 240;
if (k == 3)
{
x = x + 240; y = y + 90;
}
suc[nosuc] = new Label();
suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}

}
else if (j == 3)
{
formGraphics.DrawEllipse(myPen, j * 250 +

100, i * 100, 80, 80);

Color.Transparent;

sen[nosen] = new Label();


sen[nosen].Name = ""; sen[nosen].BackColor =
sen[nosen].Size = new Size(60, 30);
sen[nosen].Location = new Point(j * 250 +

100 + 5, i * 100 + 25);

sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0; k < 4; k++)
{
int x = lbx+600; int y = lby;
if (k == 1)
y = y + 90;
if (k == 2)
x = x + 240;
if (k == 3)
{
x = x + 240; y = y + 90;
}
suc[nosuc] = new Label();
suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}
}
else
{
50, i * 100, 80, 80);

Color.Transparent;

formGraphics.DrawEllipse(myPen, j * 250 +
sen[nosen] = new Label();
sen[nosen].Name = ""; sen[nosen].BackColor =
sen[nosen].Size = new Size(60, 30);

+ 5, i * 100

+ 25);

sen[nosen].Location = new Point(j * 250 + 50

sen[nosen].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
sen[nosen].ForeColor = Color.Blue;
sen[nosen].Text = "";
panel1.Controls.Add(sen[nosen]);
nosen++;
for (int k = 0; k < 4; k++)
{
int x = lbx+300; int y = lby;
if (k == 1)
y = y + 90;
if (k == 2)
x = x + 240;
if (k == 3)
{
x = x + 240; y = y + 90;
}
suc[nosuc] = new Label();
suc[nosuc].Name = "";
suc[nosuc].BackColor = Color.Transparent;
suc[nosuc].Size = new Size(60, 30);
suc[nosuc].Location = new Point(x, y);
suc[nosuc].Font = new
System.Drawing.Font("Palatino Linotype", 9F,
System.Drawing.FontStyle.Bold);
suc[nosuc].ForeColor = Color.Red;
suc[nosuc].Text = "";
panel1.Controls.Add(suc[nosuc]);
nosuc++;
}
}
}

}
}
for (i = no; i < 45; i++)
pcn[i] = "FREE";
int k1=0,k2=0;
for (i = 0; i < 45; i++)
{
if (i == 2 || i == 7 || i == 12 || i == 17 || i == 22 ||
i == 27 || i == 32 || i == 37 || i == 42)
{
sen[k1].Text = pcn[i].ToString();
k1++;

}
else
{
}

suc[k2].Text = pcn[i].ToString();
k2++;

}
}
}

using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;

using
using
using
using
using
using

System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;
using System.Data.SqlClient;
public partial class web_main : System.Web.UI.Page
{
SqlConnection cn = new SqlConnection("Server=.;uid=sa;Initial
Catalog=spatial");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Visible = false;
cn.Open();
cmd = new SqlCommand("select * from login where uname = '" +
txt_uname.Text + "' and pass = '" + txt_pass.Text + "'", cn);
SqlDataReader dr = cmd.ExecuteReader();

+ "");

if (dr.HasRows)
{
Session["uname"] = txt_uname.Text;
Response.Redirect("web_welcome.aspx?pname=" + txt_uname.Text
}
else
{

}
}

Label1.Visible = true;
}
cn.Close();

using
using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Text;

public partial class web_welcome : System.Web.UI.Page


{
public string name;
protected void Page_Load(object sender, EventArgs e)
{

string p;
p= Request.QueryString["pname"];
name = Session["uname"].ToString();
StringBuilder sb = new StringBuilder(4096);
sb.Append("<table>");
sb.Append("<tr>");
sb.Append(" <td>");
sb.Append(" <marquee style= font-size:x-large;fontweight:bold;width:500px;color:#5C8CD5>");
sb.Append("Welcome '" + name + "'");
sb.Append("</marquee>");
sb.Append("</td>");
sb.Append("</tr>");
sb.Append("</table>");
Label1.Text = sb.ToString();
}

using
using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;

public partial class web_register : System.Web.UI.Page


{
int sid;
DataAccess data=new DataAccess();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void REGISTER_Click(object sender, EventArgs e)

result.Visible = false;
sid = 101;
data.DBReader("select max(sid)from office");
data.dr.Read();
if (data.dr.HasRows)
{
if (data.dr[0].ToString() != "")
{
sid = Convert.ToInt32(data.dr[0]);
sid = sid + 1;
}
else
sid = 101;
}
data.DBOpen();

data.cmd = new System.Data.SqlClient.SqlCommand("Exec off_sp 1,"


+ sid + ",'" + txt_fname.Text + "','" + txt_sname.Text + "','" +
txt_pb.Text + "','" + txt_city.Text + "','" + txt_dis.Text + "','" +
txt_state.Text + "','" + txt_cou.Text + "','" + txt_pin.Text + "','" +
txt_email.Text + "'," + Convert.ToInt64(txt_phn.Text) + "", data.cn);
data.cmd.ExecuteNonQuery();
data.DBClose();
result.Visible = true;
sidlbl.Visible = true;
sidlbl.Text = "Studnt ID is " + sid + "";
}
}

using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;

public partial class web_academic : System.Web.UI.Page


{
DataAccess data = new DataAccess();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void STORE_Click(object sender, EventArgs e)
{
result.Visible = false;
data.DBOpen();
int adf = Convert.ToInt32(txt_sid.Text);
data.cmd = new System.Data.SqlClient.SqlCommand("Exec acad_sp
1," + Convert.ToInt32(txt_sid.Text) + ",'" + txt_fname.Text + "','" +
txt_sname.Text + "'," + Convert.ToInt32(txt_int1.Text) + "," +

Convert.ToInt32(txt_int2.Text) + "," + Convert.ToInt32(txt_int3.Text) +


"," + Convert.ToInt32(txt_atd.Text) + "", data.cn);
data.cmd.ExecuteNonQuery();
data.DBClose();
result.Visible = true;

using
using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;

public partial class web_seminar : System.Web.UI.Page


{
DataAccess data = new DataAccess();

protected void Page_Load(object sender, EventArgs e)


{
}
protected void STORE_Click(object sender, EventArgs e)
{
result.Visible = false;

if (Radio1.SelectedItem.Value == "2")
{
data.DBOpen();
data.cmd = new SqlCommand("Exec sem_sp 1," +
Convert.ToInt32(txt_sid.Text) + ",'" + txt_fname.Text + "','" +
txt_sname.Text + "','" + txt_stopic.Text + "','" + txt_dom.Text + "','"
+ txt_ven.Text + "','" + txt_ach.Text + "','" + txt_mem.Text + "'",
data.cn);
data.cmd.ExecuteNonQuery();
data.DBClose();
result.Visible = true;
}
if (Radio1.SelectedItem.Value == "1")
{
data.DBOpen();
data.cmd = new System.Data.SqlClient.SqlCommand("Exec sem_sp
1," + Convert.ToInt32(txt_sid.Text) + ",'" + txt_fname.Text + "','" +
txt_sname.Text + "','" + txt_stopic.Text + "','" + txt_dom.Text + "','"
+ txt_ven.Text + "','" + txt_ach.Text + "','NoMember'", data.cn);
data.cmd.ExecuteNonQuery();
data.DBClose();
result.Visible = true;
}

e)

}
protected void Radio1_SelectedIndexChanged(object sender, EventArgs
{

if (Radio1.SelectedItem.Value == "2")
{
txt_mem.Visible = true;
Label3.Visible = true;
;
}
if (Radio1.SelectedItem.Value == "1")
{
txt_mem.Visible = false;
Label3.Visible = false;
}

using System;
using System.Collections;

using
using
using
using
using
using
using
using
using
using

System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;

public partial class web_library : System.Web.UI.Page


{
DataAccess data = new DataAccess();
protected void Page_Load(object sender, EventArgs e)
{

e)

}
protected void Radio1_SelectedIndexChanged(object sender, EventArgs
{

}
protected void RadioButtonList1_SelectedIndexChanged(object sender,
EventArgs e)
{
if (RadioButtonList1.SelectedItem.Value == "1")
{
txt_pnl.Visible = true;
Label3.Visible = true;
}
if (RadioButtonList1.SelectedItem.Value == "2")
{
txt_pnl.Visible = false;
Label3.Visible = false;
}
}
protected void STORE_Click(object sender, EventArgs e)
{
result.Visible = false;
try
{
if (RadioButtonList1.SelectedItem.Value == "1")
{
data.DBOpen();
data.cmd = new System.Data.SqlClient.SqlCommand("Exec
lib_sp 1,'" + Convert.ToInt32(txt_sid.Text) + "','" + txt_fname.Text +
"','" + txt_sname.Text + "'," + Convert.ToInt32(txt_bktot.Text) + "," +
Convert.ToInt32(txt_bkret.Text) + "," +
Convert.ToInt32(txt_bkinhnd.Text) + "," + Convert.ToInt32(txt_pnl.Text)
+ "", data.cn);
data.cmd.ExecuteNonQuery();
data.DBClose();
result.Visible = true;
}
if (RadioButtonList1.SelectedItem.Value == "2")
{

data.DBOpen();
data.cmd = new System.Data.SqlClient.SqlCommand("Exec
lib_sp 1," + Convert.ToInt32(txt_sid.Text) + ",'" + txt_fname.Text +
"','" + txt_sname.Text + "'," + Convert.ToInt32(txt_bktot.Text) + "," +
Convert.ToInt32(txt_bkret.Text) + "," +
Convert.ToInt32(txt_bkinhnd.Text) + ",0", data.cn);
data.cmd.ExecuteNonQuery();
data.DBClose();
result.Visible = true;
}
}
catch
{
}
}

using
using
using
using
using
using
using
using
using
using
using
using
using

System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
System.Data.SqlClient;

public partial class web_connect : System.Web.UI.Page


{
SqlConnection cn;
SqlCommand cmd;
SqlDataAdapter da;
DataSet ds = new DataSet();
DataSet ds1 = new DataSet();
DataSet ds2= new DataSet();
string[] pcn = new string[100];
public int no = 0;
string datas = "spatial";
int i;
string sss = "SPIRO20";
string []ppc={"SPIRO16","SPIRO20","SPIRO17"};
protected void Page_Load(object sender, EventArgs e)
{
NetworkBrowser nb = new NetworkBrowser();
try
{
foreach (string pc in nb.getNetworkComputers())
{
pcn[no] = pc;
no++;
}
}
catch (Exception ex)
{
}
Label1.Visible = false;
Label2.Visible = false;
Label3.Visible = false;
Label4.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
int sid = Convert.ToInt32(TextBox1.Text);
for(i=0;i<3;i++)

{
try
{

cn = new SqlConnection("Server='" + ppc[i] + "';initial


catalog='" + datas + "';uid=sa");
cn.Open();
if (ppc[i] == "SPIRO20")
{
da = new SqlDataAdapter("select * from office where
sid=" + sid + "", cn);
da.Fill(ds1, "office");
GridView1.DataSource = ds1.Tables["office"];
GridView1.DataBind();
Label1.Text = ppc[i].ToString();
Label1.Visible = true;
}
if (ppc[i] == "SPIRO16")
{
da = new SqlDataAdapter("select * from library where
sid=" + sid + "", cn);
da.Fill(ds, "library");
GridView2.DataSource = ds.Tables["library"];
GridView2.DataBind();
Label2.Text = ppc[i].ToString();
Label2.Visible = true;
}
if (ppc[i] == "SPIRO17")
{
da = new SqlDataAdapter("select * from sport where sid="
+ sid + "", cn);
da.Fill(ds2, "sport");
GridView3.DataSource = ds2.Tables["sport"];
GridView3.DataBind();
Label3.Text = ppc[i].ToString();
Label3.Visible = true;
}
cn.Close();
catch

}
{

}
}

}
}

cn.Close();

Data Table Design:


Table Name: login
Column Name Data Type
uname
varchar
pass
varchar

Size
20
20

Table Name: office


Column Name
sid
fname
sname
Pb(Postbox)
city
dist
state
country
pin
email
phone

Data Type
int
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar
bigint

Size
4
50
50
50
50
50
50
50
50
50
8

Table Name: academic


Column Name
sid
fname
sname
mark1
mark2
mark3
atnd

Data Type
int
nvarchar
nvarchar
int
int
int
int

Size
4
50
50
4
4
4
4

Table Name: sport


Column

Data Type

Size

Name
sid
fname
sname
height
weight
game
award

int
nvarchar
nvarchar
int
int
nvarchar
nvarchar

4
50
50
4
4
50
50

Table Name: seminar

Column Name
sid
fname
sname
semtop
semdom
semven
semach
semmemb

Data Type
int
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar
nvarchar

Size
4
50
50
50
50
50
50
50

You might also like