Top Banner
ABSTRACT: The institution is the Police. The proposed system applies to Police Institutions all across the country and specifically looks into the subject of Crime Records Management. It is well understood that Crime Prevention, Detection and Conviction of criminals depend on a highly responsive backbone of Information Management. Initially, the system will be implemented across Cities and Towns and later on, be interlinked so that a Police detective can access information across all records in the state thus helping speedy and successful completion to cases. The first event in the Crime cycle starts with the reporting of a case, usually in the form of a First Information Report (FIR). The FIR is a detailed document that captures the nature of the crime, the location details, the sequence of details, information on victims. The First Information Report (FIR) is the key to a successful criminal investigation. It contains the date and time of giving the information, police station where it is recorded, place, date and time where the offence has taken place, the names of the persons who have committed the offence, probable provisions under the Indian Penal Code or any other enactment under which the offences are punishable, the information in detail, name and address of the informant and the action taken. Categorisation of Crime is a very important starting
69
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Project Report

ABSTRACT:

The institution is the Police. The proposed system applies to Police Institutions all

across the country and specifically looks into the subject of Crime Records

Management. It is well understood that Crime Prevention, Detection and Conviction

of criminals depend on a highly responsive backbone of Information Management.

Initially, the system will be implemented across Cities and Towns and later on, be

interlinked so that a Police detective can access information across all records in the

state thus helping speedy and successful completion to cases. The first event in the

Crime cycle starts with the reporting of a case, usually in the form of a First

Information Report (FIR). The FIR is a detailed document that captures the nature of

the crime, the location details, the sequence of details, information on victims. The

First Information Report (FIR) is the key to a successful criminal investigation. It

contains the date and time of giving the information, police station where it is

recorded, place, date and time where the offence has taken place, the names of the

persons who have committed the offence, probable provisions under the Indian

Penal Code or any other enactment under which the offences are punishable, the

information in detail, name and address of the informant and the action taken.

Categorisation of Crime is a very important starting point. For each major

classification of Crime, it would be essential to give atleast two levels of sub-

categorisations. An Investigation is assigned to an Investigating Officer who will

supervise all activities of collecting evidence, questioning of suspects and other

people related to the crime. The Investigating officer will have the authority for

making arrests. The solution requirement involves constructing the basic recording

system for the Crime System. This involves capturing details of the organizational

structure, district/zone details, Police station details and other important entities.

Page 2: Project Report

CHAPTER-1

1. INTRODUCTION

Page 3: Project Report

1.1 About Crime Record Management System

It is proposed to centralize Information Management in Crime for the purposes of fast

and efficient sharing of critical information across all Police Stations across the territory. The

object of the FIR is to set the criminal law in motion, whereas for the investigator it is to

gather information regarding the offence so as to take appropriate action to book the

offender. This involves capturing details of the organizational structure, district/zone details,

Police station details and other important entities. There is a need to create a

comprehensive categorization for the entities of Crime, Modus-operandi, Motive and

Suspects. There is also a need to create appropriate classification for types of evidence.

Thereafter, the FIR becomes the central entity around which additional information in terms

of evidence, suspects, etc would be added. The filing of FIRs would be carried out on the

Web and updated to the specific District Server. Crime-related querying generated from one

district server can query other district servers in the State. For example, a Modus operandi

query across the whole state would translate into a service request by the District server to

other district server and the compiled information would be routed back to the originating

query. The significant class entities are identified and carried out the class modeling.

Detailed design of Classes, Database objects and other solution components are also carried

out.

1.2 About Visual C++

Microsoft Visual C++ allows you to create many different types of applications. This guide

addresses creating and using Console Applications. A console application is a program that

runs inside a DOS window. Visual Studio 6.0 was a legend step were, we knows, there are

still lots of(maybe the most) applications, not recompiled and always under activity. For

example, today 6.0 is still the primary version in China.

Page 4: Project Report

CHAPTER-2

2. BACKGROUND AND CONCEPT

Page 5: Project Report

2.1 About Visual C++:

A C++ compiler design for implementation under windows is known as visual C++.

Fig 2-1 : C++ Implementation Environments

The Microsoft Corporation has introduced a Windows based C++ development Environment

named as Microsoft Visual C++ (MSVC).This development environment integrates a set

tools that enable a programmer to create and run C++ programs with ease and style.

Microsoft call this integrated development environment as visual workbench.

2.1.1 History of Visual C++:

Prior to Visual C++, Microsoft C Version 6 existed on 8 floppies, did not support C++ but did

support OS/2. It could be executed using either 16-bit Windows or OS/2. The editor was

called Programmer's Workbench. There were versions of Microsoft C prior to version 6.

Visual C++ was first named Microsoft C/C++ Compiler 7.0 and was shipped on floppy disks.

Then Visual C++ came with the following version: Visual C++ 1.0 for Windows NT, then

Visual C++ for Win16 (v1.5 and now v1.52c) and then, with a Win32s inter-period, there was

the great new product named Visual C++ 2.0 and the Win32 and 32bits era. Visual C++ 1.0

was shipped for free when buying a book at MS Press named, Visual C++ Step by Step. The

success of the Visual C++ product, appeared with the version 2.2 and the content of a great

documentation. The Windows help was progressively canceled, and the way developer

should learned about SDK and Visual Studio was included in MVB files, covered in Visual C++

4.x. At this time, the MSDN documentation was completely integrated with the IDE. It was

C++ Implementation

MS-DOS Environment Windows Environment

Conventional C++ Visual C++

Page 6: Project Report

running extremely fast and everything was on a CD Rom... The compiler was becoming

better and better, when Visual C++2.x era was ended. The episode of pre-compiled headers

bug was finished, and the total time of compilation was shorter and shorter. Projects

Settings were very well designed and the IDE (as always) was getting more and more

comfortable.

Version 5.0 appears and the brand name Visual Studio was written, in bold, upper to the

Visual C++ product name.

Visual Studio 6.0 was a legend step were, we knows, there are still lots of applications, not

recompiled and always under activity. For example, today 6.0 is still the primary version in

China.

Microsoft C/C++ 7.0

Visual C++ 1.0

Visual C++ 1.5

Visual C++ 2.0

Visual C++ 2.1

Visual C++ 2.2

Visual C++ 4.0

Visual C++ 4.1

Visual C++ 4.2

Visual C++ 5.0

Visual C++ 6.0

Visual C++ .NET 2002 (Version 7.0)

Visual C++ .NET 2003 (Version 7.1)

Visual C++ 2005 (Version 8.0)

In 2006-2007, Visual C++ compiler will merge the C++ STL with a .NET compatible runtime

library called STL.NET. It will embrace Managed C++ and fully compliant C++ library. Visual

C++ is, in 2007, the best compiler product that Microsoft has shipped.

Page 7: Project Report

In 2007, Visual Studio Team has published a Virtual machine that contains the STL/CLR alias

STL.NET named library. Check out from the next release of the STL evolution.

In 2007, ATL Server has been promoted under codeplex.com portal: check

www.codeplex.com/atlserver

2.1.2 What's New in Visual C++ Version 6.0

Microsoft® Visual C++ version 6.0 provides many new features, described below.

Compiler

assume Keyword

Better Inlining Control

Dependencies Now Stored in a Text File

Dependency (.dep) File Generation

New and Improved Warnings

Placement Form of Operator Delete

Pragma Warning

Run-Time Error Checks

Throughput Improvements

Debugger

AfxDump Stack for Diagnosing Field-Installed Applications

Edit and Continue

GetLastError() Value Displayed as Register

GUIDs Decoded for Display

Page 8: Project Report

Improved Disassembler Output (Undecorated Symbols)

Improved V-Table and Function Pointer Display

In-Process Remote Procedure Calls

Load COFF & Exports Option

MASM Hex Syntax Supported

MMX Register Display

Module List Dialog Box

New Formatting Symbols

Thread Information Block

Variants Decoded for Display

Projects

Command-Line Builds

Dynamic Parsing (Dynamic Updating of ClassView)

"GoTo Dialog Editor" from ClassView and WizardBar

MIDL Options Page: Project Settings Dialog Box

"New Form" Command

New HTML Resource Type

New Project Types: Extended Stored Procedures and Utility Project

Support for Environment Variables in the IDE

Page 9: Project Report

Wizards

AppWizard Enhancements

AppWizard support for OLE DB

Cluster Resource Type Wizard

Custom build rules for Help files

Data Access Support in the ATL Object Wizard

"Delete Member Function" Command in WizardBar and ClassView

Internet Explorer 4.0 (IE4) Control Support in ClassWizard

New Dictionary Fields (Macros) for Custom AppWizard

New Extended Stored Procedure Wizard

New project types

Wizards for non-MFC project types

Microsoft Foundation Class Library (MFC)

Active Document Containment

Dynamic HTML Control with CHtmlView

Internet Explorer 4.0 Common Controls

MFC Classes — New or Updated

MFC Globals - New

Wizard97 Style for Property Sheets

MFC OLE DB Class Added

Page 10: Project Report

MFC Performance Tuning

New MFC Technical Notes

Database Support

ADO Data-Bound Dialog Wizard

Data-Bound Controls for ADO and OLE DB

Oracle Support in the Data Tools

2.2 Starting with Microsoft Visual C++ 6.0:

Microsoft Visual C++ allows you to create many different types of applications. This guide

addresses creating and using Console Applications. A console application is a program that

runs inside a DOS window.This guide is divided into the following sections:

Starting Visual C++

Creating and Executing a Single-File Console Application

Importing and Executing C++ Source Code Files

2.2.1 Starting VC++

To start the Microsoft Visual C++ compiler, click the Start button on the task bar to open the

start menu. Open the Programs menu (All Programs in Windows XP) and select Microsoft

Visual C++ 6.0. If a Tip of the Day dialog box appears, click the close button to close the

dialog box. If the Microsoft Visual C++ window is not maximized, click the maximize button

in the upper right corner of the title bar.

Page 11: Project Report

Fig 2-2: Microsoft Visual C++ 6.0

Figure 2-2 shows the initial application window. If your application window looks different,

you may need to adjust the menu bar settings. This is accomplished by right-clicking the

menu bar and modifying the settings until the Standard toolbar is the only item selected as

shown in Figure2-3.

Fig 2-3: initial menu settings

2.2.2 Creating and Executing a Single-File Console Application

Creating and Executing a Single-File Console Application 3

One of the most common programs encountered in an introductory C++ programming

Page 12: Project Report

class is a single source code file that contains the main function.To construct this type

of application, you need to:

Create a Win32 Console Application Project

Add a source code file

Write the program

Execute the program

Debug the program

Create a Win32 Console Application Project

Start Microsoft Visual C++. Select New from the File menu.

Fig 2-4:Create a New Project

When the New Project dialog box opens, enter the following information (see Figure 2-5):

Select Win32 Console Application

Enter the project name in the Project Name textbox

Select the location for the project in the Location textbox

Page 13: Project Report

Fig 2.5:Input to new project

The application provides a default location for saving projects or you can select your own

location by pressing the button to the right of the location textbox to open the Choose

Directory dialog box. Press the OK button after entering the required information into the

dialog box. When the Win32 Console Application wizard appears, select An empty project.

(see Figure 2-6) and then press the Finish button. When the New Project Information dialog

box appears, select OK.

Fig 2-6 :Win32 Console Application Wizard

Page 14: Project Report

2.2.3 Creating and Executing a Single-File Console Application

Add a Source File

Add a blank source code file to your project by selecting New from the File menu. (See

Figure 2-7.)

Fig 2-7:Adding Project Files

When the New file dialog box appears, select C++ Source File, type the file name into

the File Name textbox (see Figure 2-8), and press the OK button.

Fig 2-8:New File Settings

2.2.4 Write the Program

Page 15: Project Report

Type the source code for your program into the section located in the right side of the

window. Figure:2-9 contains the source code for a simple C++ console program that displays

the phrase Hello World. Note that the C++ editor automatically selects different colors for

C++ reserved words and provides automatic indentation for blocks of code.

Fig 2-9: Hello World Source Code File

2.2.5 Executing the Program

Before you can execute the program you have written, you must save it and compile it.To

save the file, select Save from the File menu. Once the program is saved, you compile it by

selecting the Compile option from the Build menu.

Creating and Executing a Single-File Console Application

Fig 2-10:Compiling a Program

Page 16: Project Report

Once the program compiles, the results will be shown in the Output Window. (See Figure 2-

11.) In this example, the program compiled with no errors and no warnings.

Fig2-11:Results of Compiling the Program

After successfully compiling the program, the next step is to take the compiled object code

and build the executable file necessary to run the program. In Microsoft Visual C++ 6.0, this

is accomplished by selecting the Build option from the Build menu. (See Figure 2-12.)

Fig 2-12:Initiating the Build Process

In this example, there were no errors or warnings generated by the build process.

Page 17: Project Report

Fig 2-13:Results of the Build Process

After the build process has been successfully completed, you can now execute the program

by selecting Execute from the Build menu. (See Figure 2-14.)

2.2.6 Creating and Executing a Single-File Console Application

Fig 2-14:Initiating Program Execution

The program results will appear in a new DOS window. Notice that the phrase “Press any

key to continue” has been added to the program output. This additional code was added to

keep the DOS window open until you have had a chance to view the output and press a key

Page 18: Project Report

on the keyboard. (See Figure 2-15.) Once a key on the keyboard is pressed, the program

stops execution and the DOS window closes.

Fig 2-15:Program Results

2.2.7 Debug the Program

Often, the program will have errors when you attempt to compile, build, and execute it.The

program that was successfully executed in the previous example has been modified to

include an error—the semi-colon at the end of the return 0 statement has been removed.

When the modified program is compiled, an error is displayed in the output window.

Fig2-16 :Compile Error

Page 19: Project Report

You can determine where the compiler found the error by double-clicking on the error

message in the output window.This will cause a pointer to appear in the left margin of

the source file where the error was encountered.

2.2.8 Importing and Executing C++ Source Code Files

Fig2-17:Locating a Compile Error

Notice in this case that the pointer is on the line after the line containing the actual error.

This occurs when the error induces a compiler recognized fault on a subsequent line. While

not always exact, the error pointer, in conjunction with the error description, can help

locate errors in the source code. Once the error is identified and corrected, the program

must be saved, re-compiled, built, and executed again.

2.3 Microsoft Foundation Class Library (MFC):

The Microsoft Foundation Class Library (MFC) is an "application framework" for

programming in Microsoft Windows. Written in C++, MFC provides much of the code

necessary for managing windows, menus, and dialog boxes; performing basic input/output;

storing collections of data objects; and so on. All you need to do is add your application-

Page 20: Project Report

specific code into this framework. And, given the nature of C++ class programming, it's easy

to extend or override the basic functionality the MFC framework supplies. The MFC

framework is a powerful approach that lets you build upon the work of expert programmers

for Windows. MFC shortens development time; makes code more portable; provides

tremendous support without reducing programming freedom and flexibility; and gives easy

access to "hard to program" user-interface elements and technologies, like Active

technology, OLE, and Internet programming. Furthermore, MFC simplifies database

programming through Data Access Objects (DAO) and Open Database Connectivity (ODBC),

and network programming through Windows Sockets. MFC makes it easy to program

features like property sheets ("tab dialogs"), print preview, and floating, customizable

toolbars.

2.3.1 The following MFC features are new for Visual C++ 6.0:

Active Document Containment

Active Document Containment provides a single frame in which to work with documents,

instead of requiring you to create and use multiple application frames for each document

type. It differs from basic OLE technology in that OLE works with embedded objects within a

compound document in which only a single piece of content can be active. With Active

Document Containment, you activate an entire document, that is, an entire application,

including associated menus and toolbars, within the context of a single frame. AppWizard

automates the MFC coding required for Active Document Containment. Active Document

Containment is implemented by using the new class COleDocObjectItem.

Dynamic HTML Control with CHtmlView

A new MFC class, CHtmlView, enables you to host Dynamic HTML within your MFC

applications. CHtmlView allows your application's view to display HTML pages that contain

Dynamic HTML just as a Web browser would display them. CHtmlView provides many

browser features, including a history list, favorites (bookmarks), and security features. See

Web Browser-Style Applications.

Internet Explorer 4.0 Common Controls

Page 21: Project Report

MFC provides support for the latest Internet Explorer 4.0 common controls in classes such

as CComboBoxEx, CDateTimeCtrl, CIPAddressCtrl, and CMonthCalCtrl. You can access these

controls from the Controls toolbar in the Dialog editor. In addition to these new control

classes, new functionality was added to most of the existing MFC common control classes.

These modifications include flat toolbars, image list support for several control types (such

as header, toolbar, and status bar controls), and new attributes. These new properties are

also supported in the Dialog editor controls.

2.3.2 MFC Classes — New or Updated

Class Control Status Description

CComboBoxEx Extended

combo box

New Extends the combo box control by

providing support for image lists.

CDateTimeCtrl Date and

time picker

New Supports either an extended edit

control, or a simple calendar interface

control, that allows a user to choose a

specific date or time value.

CHeaderCtrl Header Updated Supports drag-and-drop operations and

bitmaps in a header control.

CHtmlView No New Supports a control for Web browsing

within an application. The control

supports Dynamic HTML in MFC.

CHttpServer No Updated Includes a new function for writing data

to the server.

CHttpServerContext No Updated Includes new functions that provide

control over the size of chunks written

to the HTTP server.

CImageList Image list Updated Supports images used by other controls,

for example, in header controls and list

Page 22: Project Report

controls.

CInternetSession No Updated Supports setting cookies for a specified

URL, returning cookies for a specified

URL and all its parent URLs, and

retrieving the variable specifying the

length of the cookie stored in the buffer.

CIPAddressCtrl Address New Supports an edit box for manipulating an

Internet Protocol (IP) address.

CListCtrl List Updated Supports the grouping of items using

working areas. Also supports virtual list

views.

CMenu No Updated Supports assigning or retrieving a

default menu item on a specified menu,

and retrieving information about a menu

item.

CMonthCalCtrl Month

calendar

New Supports a simple calendar interface

control that allows a user to select a

date.

COleClientItem No Updated Contains a new function that retrieves a

handle to an icon associated with the

server of a particular CLSID.

COleDBRecordView No New Provides MFC OLE DB support for form

views.

COleDocObjectItem No New Supports active document containment.

COleDateTime No Updated Supports converting time information

stored in the object to a Win32-

compatible SYSTEMTIME structure.

Page 23: Project Report

CProgressCtrl Progress Updated Supports smooth and vertical styles for

progress controls.

CPropertySheet No Updated Supports property sheets with stacked

or scrolling tabs.

CPropertySheetEx No New Supports the Wizard97 style of property

sheets, available with Windows 98 and

Windows NT 5.0.

CPropertyPageEx No New Supports the Wizard97 style of property

pages, available with Windows 98 and

Windows NT 5.0.

CReBar No New Supports a toolbar that can contain

additional child windows in the form of

controls.

CRebarCtrl Rebar New Implements the internal control of the

CRebar object.

CSliderCtrl Slider Updated Supports ToolTips in a slider control and

additional slider control styles.

CSpinButtonCtrl Spin button Updated Supports 32-bit ranges in a spin button

control.

CStatusBar No Updated Supports ToolTips, icons, and

background color in a status bar.

CStatusBarCtrl Status bar Updated Implements the internal control of the

CStatusBar object.

CString No Updated Supports enhanced string finding,

replacing, removing, inserting, deleting,

and formatting.

CTabCtrl Tab Updated Supports new styles for tab focus and

Page 24: Project Report

appearance. Also supports inserting new

tabs into an existing tab control.

CTime No Updated Supports converting time information

stored in the object to a Win32-

compatible SYSTEMTIME structure.

CToolBar No Updated Supports Internet Explorer 4.0 flat and

transparent toolbar styles.

CToolBarCtrl Toolbar Updated Implements the internal control of the

CToolBar object.

CToolTipCtrl Tool tip Updated Implements updating of a ToolTip and its

attributes.

CTreeCtrl Tree Updated Supports check boxes and automatic

single-node expansion in a tree control.

2.3.3 CDialog::CDialog

Use either one of these constructors to construct a resource-based modal dialog box. One

form of the constructor provides access to the dialog resource by template name. The other

constructor provides access by template ID number, usually with an IDD_ prefix (for

example, IDD_DIALOG1).

At a Glance

Header File Afxwin.h

Platforms

Versions 1.0 and later

Call this member function to invoke the modal dialog box and return the dialog-box result

when done.

Page 25: Project Report

At a Glance

Header File Afxwin.h

Platforms

Versions 1.0 and later

CDialog::OnInitDialog

The framework calls this member function in response to the WM_INITDIALOG message.

This message is sent to the dialog box during the Create, CreateIndirect, or DoModal calls,

which occur immediately before the dialog box is displayed.

At a Glance

Header File Afxwin.h

Platforms

Versions 1.0 and later

2.3.4 CRecordset

A CRecordset object represents a set of records selected from a data source. Known as “recordsets,” CRecordset objects are typically used in two forms: dynasets and snapshots. A dynaset stays synchronized with data updates made by other users. A snapshot is a static view of the data. Each form represents a set of records fixed at the time the recordset is opened, but when you scroll to a record in a dynaset, it reflects changes subsequently made to the record, either by other users or by other recordsets in your application.

2.3.5 CObject

CObject is the principal base class for the MFC.

At a Glance

Header file: Afx.h

Page 26: Project Report

Platforms:

Versions: 1.0 and later

These functions are the standard CObject constructors. The default version is automatically

called by the constructor of your derived class.

CCmdTarget

Fig:2-18

CCmdTarget is the base class for the Microsoft Foundation Class library message-map

architecture. All classes that handle messages are derived, directly or indirectly, from this

class.

At a Glance

Header File Afxwin.hPlatformsVersions 1.0 and later

Working with Oracle Databases

The Microsoft® Visual Database Tools have been designed to work with Oracle databases

transparently — you can design database diagrams, queries, and views in the same way you

would for any database. In addition, the tools are Oracle-aware, allowing you to incorporate

Oracle data objects such as synonyms, produce Oracle-specific SQL commands, and so on. In

a few instances, however, you will find it useful to know how the Visual Database Tools

differ when you are working with Oracle databases. For example, it is helpful to understand

CObject

CCmd Target

Page 27: Project Report

how the Query Designer will work with case-sensitive database object names in Oracle. The

topics listed in the following table provide information specific to using the Database

Designer and Query Designer with Oracle databases.

Data View for Oracle Databases

For Oracle databases, you will see some differences in the Project Explorer (FileView in

Microsoft® Visual C++®) and Data View windows. For example, when you add a connection to

an Oracle database, you will see these folders under the connection: Database Diagrams,

Tables, Views, Synonyms, Stored Procedures, and Functions. The Tables folder contains the

base tables in your database. The Views folder contains any SELECT statements saved as

views.

Synonyms

The Synonyms folder contains synonyms in your database, which are names assigned to

tables or views that may thereafter be used to refer to them. You can also create new

synonyms.

To create a new synonym

From a query or SQL script, execute the following statement:

create synonym name

for table

Substitute the name of the new synonym for name and the name of a table for table. For

more details about synonyms, refer to your Oracle documentation.

Functions

The Functions folder contains the functions in your database. For details about functions,

refer to your Oracle documentation.

Page 28: Project Report

CHAPTER-3

Page 29: Project Report

3. PROJECT DESCRIPTION

3.1 Connectivity:

There are two types of connectivity: (i) ODBC connection

(ii) DAO connection

3.1.1 Why Migrate from ODBC to DAO?

There are a number of reasons why you might want to migrate applications from the ODBC

Database Classes to the DAO Database Classes, but the decision is not necessarily simple or

obvious. One thing to keep in mind is that the Microsoft Jet database engine that is used by

DAO can read any ODBC data source for which you have an ODBC driver. It may be more

efficient to use the ODBC Database Classes or call ODBC directly yourself, but the Microsoft

Jet database engine can read ODBC data.

There are some simple cases that make the ODBC/DAO decision easy. For instance, when

you only need access to data in a format that the Microsoft Jet engine can read directly

(Access format, FoxPro format, Excel format, and so on) the obvious choice is to use the

DAO Database Classes. More complex cases arise when your data exists on a server or on a

variety of different servers. In this case, the decision to use the ODBC Database classes or

the DAO Database classes is a difficult one. If you want to do things like heterogeneous joins

(join data from servers in multiple formats like SQL Server and Oracle), then the Microsoft

Jet database engine will perform the join for you rather than forcing you to do the work

necessary if you used the ODBC Database Classes or called ODBC directly. If you are using an

ODBC driver that supports driver cursors, your best choice might be the ODBC Database

classes.

The choice can be complicated, so you might want to write some sample code to test the

performance of various methods given your special needs. This technical note assumes that

you have made the decision to migrate from the ODBC Database Classes to the DAO

Database classes.

Page 30: Project Report

3.1.2 Similarities Between ODBC Database Classes and MFC DAO Database Classes

The original design of the MFC ODBC classes was based on the DAO object model that has

been in use in Microsoft Access and Microsoft Visual Basic. This means that there are many

common features of the ODBC and DAO MFC classes, which will not all be listed in this

section. In general, the programming models are the same.

To highlight a few similarities:

Both the ODBC and DAO classes have database objects that manage using the

underlying database management system (DBMS).

Both have recordset objects representing a set of results returned from that DBMS.

The DAO database and recordset objects have members nearly identical to the ODBC

classes.

With both sets of classes, the code to retrieve data is identical except for some

object and member name changes. Changes will be required, but usually the process

is a straightforward name change when switching from the ODBC classes to DAO

classes.

For example in both models the procedure to retrieve data is to create and open a database

object, create and open a recordset object, and navigate (move) though the data

performing some operation.

3.2 ODBC Connections

ODBC connections are configured in the system control panel. ODBC connections can be

made against any data source for which an ODBC driver has been installed. Visual C++ 6.0

ships drivers for Text files, Access, FoxPro, Paradox, dBase, Excel, SQL Server, and Oracle.

When you create an ODBC connection, it automatically receives a Data Source Name (DSN).

Page 31: Project Report

The DSN is subsequently used to identify connections in data-source controls, such as ADO

Data Control and RDO RemoteData Control.

OLE DB Connections No additional work is necessary to configure an OLE DB connection.

For example, if an ODBC data source is created, the OLE DB provider for ODBC automatically

detects it.

3.2.1 To configure an ODBC data source

1. Click on the Start button, select Settings, and then Control Panel.

2. In Control Panel, select 32bit ODBC (Windows 95) or ODBC (Windows NT).

3. Select the User DSN or System DSN tab. User DSN lets you create user-specific data-

source names and System DSN lets you create data-sources available to all users.

4. Click Add to display a list of locally installed ODBC drivers.

5. Select the driver corresponding to the type of indexed sequential access method

(ISAM) or database you want to connect to and click Finish.

6. Follow the instructions specific to the driver. After closing, the DSN is now available

for use.

When generating a DSN for some ODBC driver types, you need to know the location of the

actual file. For example when creating an Access DSN, you need to know the location of

the .mdb file. Also, you should have a valid username and password. For example, the

system username for most Access systems is admin.

3.2.2 CDaoDatabase

Fig:3-1

CObject

CDao Database

Page 32: Project Report

A CDaoDatabase object represents a connection to a database through which you can

operate on the data. For information about the database formats supported, see the

GetName member function. You can have one or more CDaoDatabase objects active at a

time in a given “workspace,” represented by a CDaoWorkspace object. The workspace

maintains a collection of open database objects, called the Databases collection. The MFC

DAO database classes are distinct from the MFC database classes based on ODBC. All DAO

database class names have the “CDao” prefix. Class CDaoDatabase supplies an interface

similar to that of the ODBC class CDatabase. The main difference is that CDatabase accesses

the DBMS through Open Database Connectivity (ODBC) and an ODBC driver for that DBMS.

CDaoDatabase accesses data through a Data Access Object (DAO) based on the Microsoft

Jet database engine. In general, the MFC classes based on DAO are more capable than the

MFC classes based on ODBC; the DAO-based classes can access data, including through

ODBC drivers, via their own database engine. The DAO-based classes also support Data

Definition Language (DDL) operations, such as adding tables via the classes, without having

to call DAO directly.

Usage

You can create database objects implicitly, when you create recordset objects. But you can

also create database objects explicitly. To use an existing database explicitly with

CDaoDatabase, do either of the following:

Construct a CDaoDatabase object, passing a pointer to an open CDaoWorkspace

object.

Or construct a CDaoDatabase object without specifying the workspace (MFC creates

a temporary workspace object).

3.2.3 Differences Between ODBC and DAO MFC Classes

The DAO classes include more objects and a richer set of methods, but this section will only

detail the differences in similar classes and functionality. Probably the most obvious

differences between the classes are the name changes for similar classes and global

Page 33: Project Report

functions. The following list shows the name changes of the objects, methods and global

functions associated with the database classes:

Data Source Name(DSN):

An ODBC term for the collection of information used to connect your application to a

particular ODBC database. The ODBC Driver Manager uses this information to create a

connection to the database. A DSN can be stored in a file (a file DSN) or in the Windows®

Registry (a machine DSN).

A string expression that is the name used in the Open Connection method that refers to a

block of descriptive information about the data source. For example, if the data source is an

ODBC remote database, it could be the name of the server.

3.3 Database design:

3.3.1 Table

The fundamental structure of a relational database management system. In Visual FoxPro, a

table stores data in records (rows) and fields (columns). The data is usually about a

particular category of things, such as customers, customer orders, employees, or inventory

parts. Each Visual FoxPro table can be stored in its own file with a .dbf extension or

contained in a database.

3.3.2 Creating a Database Table

You can create a new table in a database through the menu system, the Project Manager, or

through the language. As you create the table, you can create long table and field names,

default field values, field- and record-level rules, as well as triggers.

3.3.3 To create a new database table

In the Project Manager, select a database, then Tables, and then New to open the

Table Designer.

Page 34: Project Report

Use the CREATE TABLE command with a database open.

For example, the following code creates the table small tbl with one column, called name:

OPEN DATABASE Sales

CREATE TABLE smalltbl (name c(50))

field

A location in a record where data is stored; used in some database systems to mean

"column."

primary key

A column or combination of columns that uniquely identifies a row in a table. It cannot

allow null values and must always have a unique index. A primary key is used to relate a

table to foreign keys in other tables.

data dictionary

A table containing information about all the tables in a database. The information stored in

a data dictionary is meta-data, or data about the data, such as long table and field names,

validation rules and triggers, and definitions for database objects such as views and named

connections.

3.4 Recordset

A CRecordset object represents a set of records selected from a data source. The records

can be from:

A table

A query

A stored procedure that accesses one or more tables

Page 35: Project Report

An example of a recordset based on a table is “all customers,” which accesses a Customer

table. An example of a query is “all invoices for Joe Smith.” An example of a recordset based

on a stored procedure (sometimes called a predefined query) is “all of the delinquent

accounts,” which invokes a stored procedure in the back-end database. A recordset can join

two or more tables from the same data source, but not from different data sources.

3.4.1 Recordset Capabilities

All recordset objects share the following capabilities:

If the data source is not read-only, you can specify that your recordset be updatable,

appendable, or read-only. If the recordset is updatable, you can choose either

pessimistic or optimistic locking methods, provided the driver supplies the

appropriate locking support. If the data source is read-only, the recordset will be

read-only.

You can call member functions to scroll through the selected records.

You can filter the records to constrain which records are selected from those

available.

You can sort the records in ascending or descending order, based on one or more

columns.

You can parameterize the recordset in order to qualify the recordset selection at run

time.

A recordset object gives you access to all the selected records. You scroll through the

multiple selected records using CRecordset member functions, such as MoveNext

and MovePrev. At the same time, a recordset object represents only one of the

selected records, the “current record.” You can examine the fields of the current

record by declaring recordset class member variables that correspond to columns of

the table or of the records that result from the database query. ClassWizard helps

you declare these recordset class data members. You update a record by scrolling to

it — making it the current record — and changing the values of these data members.

Page 36: Project Report

3.4.2 Types of Recordsets:

1. Dynaset-type Recordset — the result of a query that can have updatable records. A

dynaset-type Recordset object is a dynamic set of records that you can use to add,

change, or delete records from an underlying database table or tables. A dynaset-

type Recordset object can contain fields from one or more tables in a database. This

type corresponds to an ODBC keyset cursor.

2. Snapshot-type Recordset — a static copy of a set of records that you can use to find

data or generate reports. A snapshot-type Recordset object can contain fields from

one or more tables in a database but can't be updated. This type corresponds to an

ODBC static cursor

Snapshots and Dynasets

There are two principal kinds of recordsets: snapshots and dynasets. Both are supported by

class CRecordset. Each shares the common characteristics of all recordsets, but each also

extends the common functionality in its own specialized way. Snapshots provide a static

view of the data and are useful for reports and other situations in which you want a view of

the data as it existed at a particular time. Dynasets are useful when you want updates made

by other users to be visible in the recordset without having to requery or refresh the

recordset. Snapshots and dynasets can be updatable or read-only. In order to reflect records

added or deleted by other users, call CRecordset::Requery.

CRecordset also allows for two other kinds of recordsets: dynamic recordsets and forward-

only recordsets. Dynamic recordsets are similar to dynasets; however, dynamic recordsets

reflect any records added or deleted without calling CRecordset::Requery. For this reason,

dynamic recordsets are generally expensive with respect to processing time on the DBMS,

and many ODBC drivers do not support them. In contrast, forward-only recordsets provide

the most efficient method of data access for recordsets that don't require updates or

backward scrolling. For example, you might use a forward-only recordset to migrate data

from one data source to another, where you only need to move through the data in a

forward direction. To use a forward-only recordset, you must do both of the following:

Page 37: Project Report

Pass the option CRecordset::forwardOnly as the nOpenType parameter of the Open

member function.

Specify CRecordset::readOnly in the dwOptions parameter of Open.

3.5 DialogBox

The DialogBox macro creates a modal dialog box from a dialog box template resource.

DialogBox does not return control until the specified callback function terminates the modal

dialog box by calling the EndDialog function. The DialogBox macro uses the

DialogBoxParam function.

3.5.1 Modal and Modeless Dialog Boxes

Dialog boxes are either modal or modeless. A modal dialog box must be closed (hidden or

unloaded) before you can continue working with the rest of the application. For example, a

dialog box is modal if it requires you to click OK or Cancel before you can switch to another

form or dialog box. The About dialog box in Visual Basic is modal. Dialog boxes that display

important messages should always be modal — that is, the user should always be required

to close the dialog box or respond to its message before proceeding.

Modeless dialog boxes let you shift the focus between the dialog box and another form

without having to close the dialog box. You can continue to work elsewhere in the current

application while the dialog box is displayed. Modeless dialog boxes are rare. From the Edit

menu, the Find dialog box in Visual Basic is an example of a modeless dialog box. Use

modeless dialog boxes to display frequently used commands or information.

3.5.2 To display a form as a modal dialog box

Use the Show method with a style argument of vbModal (a constant for the value 1).

For example:

Display frmAbout as a modal dialog.

Page 38: Project Report

frmAbout.Show vbModal

To display a form as a modeless dialog box

Use the Show method without a style argument.

For example:

Display frmAbout as a modeless dialog.

frmAbout.Show

3.6 DoDataExchange

virtual void DoDataExchange( CDataExchange* pDX );

Called by the framework to exchange and validate dialog data. Never call this function

directly. It is called by the UpdateData member function. Call UpdateData to initialize a

dialog box’s controls or retrieve data from a dialog box.

When you derive an application-specific dialog class from CDialog, you need to override this

member function if you wish to utilize the framework’s automatic data exchange and

validation. ClassWizard will write an overridden version of this member function for you

containing the desired “data map” of dialog data exchange (DDX) and validation (DDV)

global function calls. To automatically generate an overridden version of this member

function, first create a dialog resource with the dialog editor, then derive an application-

specific dialog class. Then call ClassWizard and use it to associate variables, data, and

validation ranges with various controls in the new dialog box. ClassWizard then writes the

overridden DoDataExchange, which contains a data map. The DoDataExchange overridden

member function must precede the macro statements in your source file.

3.7 CWnd::UpdateData

BOOL UpdateData( BOOL bSaveAndValidate = TRUE );

Page 39: Project Report

Return Value

Nonzero if the operation is successful; otherwise 0. If bSaveAndValidate is TRUE, then a

return value of nonzero means that the data is successfully validated.

Parameters

bSaveAndValidate

Flag that indicates whether dialog box is being initialized (FALSE) or data is being retrieved

(TRUE). The framework automatically calls UpdateData with bSaveAndValidate set to FALSE

when a modal dialog box is created in the default implementation of CDialog::OnInitDialog.

The call occurs before the dialog box is visible. The default implementation of

CDialog::OnOK calls this member function with bSaveAndValidate set to TRUE to retrieve

the data, and if successful, will close the dialog box. (If the Cancel button is clicked in the

dialog box, the dialog box is closed without the data being retrieved.)

Page 40: Project Report

CHAPTER-4

Page 41: Project Report

Police CriminalCaught

Bhadrak police station

HasRecord

Belongs to

Ph no.

Salary

Sub inspector

Department

Name

Birth place

Date of birth Height

Terrorist

Age

Name

Lock up

Head quater

Staff membersss

Branch

District

address

Photo

Case no.Forensic report

Date

Address

4. TECHNICAL DESIGN

4.1.Entity-relationship diagram:

Page 42: Project Report

4.2.Data flow diagram:

4.2.1.Context diagram

see data search data

insert data

update data

display data

4.2.1.(a).Level-1 DFD

Update data

Insert data Update data

Total data

Search data Search data

User

Orissa Crime Record 0 Police Incharge

Insert criminal details 0.1

Inquiry investigate 0.2

Police incharge

Display data 0.3

Search records 0.4

User

Display criminal details

Page 43: Project Report

4.2.1.(b).Level-2 DFD

Criminals details Police details victim details

Data

eg.

Crime Id 0.1.1

Criminal name 0.1.2

Case no 0.1.3

Police station 0.1.4

Victim address 0.1.7

Criminal address 0.1.6

Police zone 0.1.5

Details about all criminals

Page 44: Project Report

CHAPTER-5

5. IMPLEMENTATION AND RESULT

Page 45: Project Report

Our project is on POLICE CRIME RECORD MANAGEMENT SYSTEM . We use the Microsoft

Visual C++ as front end for designing our project . We use the ODBC connection to connect

with oracle as back end.

After the completion of coding ,compilation it shows as follows.

Fig5.1: Connection is success

Then click OK, then the main menu is seen.

5.1 File menu

The title bar contains the title of our project as MAIN ORISSA CRIME . The menu bar

contains different menus which are required by our project.

1.When we click on the FILE menu three options comes, when we click on the criminal

photo other two options comes, which are shown below in fig5-2.

Page 46: Project Report

Fig5-2: shows main menu

5.1.1 Display criminal ids photoes

On clicking on DISPLAY CRIMINAL IDS PHOTOES, the previously stored criminal photos with

their Ids and name are shown as follows.

Fig5-3: shows criminal photoes with their Ids

Page 47: Project Report

5.2 Insert menu

2.When we click on INSERT menu the options comes like this.

The INSERT menu is used to insert data about a crime which is not recorded. In back-end we

are using ORACLE. We are using ODBC connection to connect with ORACLE. When the

connection is success we can insert data through this INSERT menu.

5.2.1 Insert crime record

Now click on CRIME RECORD the output will come like shown in the fig:5-4 . There are many

options which are shown in the figure. Some fields are compulsory in which data must be

inserted, we cannot left it blank. After filling all the fields click on INSERT button, then the

data will be inserted into the Oracle DataBase.

Fig5-4: shows to insert crime details

If we want to display the CRIME DETAILS or CRIMINAL DETAILS or VICTIM DETAILS or

OFFICIAL DETAILS, then click on that item, as shown.

Page 48: Project Report

5.3 Display menu

5.3.1 Display crime details

When we click on DISPLAY CRIME DETAILS and select an criminal id., then we can see crime

details as follows.

Fig5-5: shows crime details.

4. If we want to search criminal details using CRIMEID or CASENO or CRIMIAL NAME,

searching can be done as follows.

5.4 Search menu

We use this menu bar for searching purpose. For any details required about crime we can

search through this menu bar and can get it. When we click on this menu three options

comes.

Page 49: Project Report

5.4.1 Search with crime-id

When we click on SEARCH WITH CRIMEID this option tells that we can search about crime

detail only when we know the CRIME ID and select that from ComboBox. Otherwise we

cannot search through this option. When we give a known crime id to this field it will give

the output like this.

Fig5-6: shows searching with crime-id.

5.4.2 search with case no.

When we click on SEARCH WITH CASENO this option tells that we can search about crime

detail only when we know the CASENO . and select the CASENO from the Combobox. When

we give a known CASENO to this field it will give the output like this. It will give the

information about other fields only when we give the CASE NO to it.

Page 50: Project Report

Fig5-7: shows searching with case no.

5.4.3 search with name

When we click on SEARCH WITH NAME this option tells that we can search about a crime

detail only when we know the NAME. When we give a known NAME to this NAME to this

field it will give the output like this. It will give the information about other fields only when

we give the NAME to it.

Fig5-8: shows searching with name.

Page 51: Project Report

5.5 help menu

Then we can take the help from the HELP button as follows.

Fig5-9: shows about developers.

5.6 Future work

Now this project is developed only for the stand-alone system, and we plan to make this

suitable for Web-based system, so that any person from anywhere can see the CRIME

DETAILS of any criminal and case status.

Page 52: Project Report

CONCLUSION

The project has been appreciated by all the users in different organizations.

We can also avoid crime in our society up to some extent.

It is easy to use, since it uses the GUI provided in the user dialog.

User friendly screens are provided.

The usage of software increases the efficiency, decreases the effort.

It has been efficiently employed as a site management mechanism.

It has been thoroughly tested and implemented.

I think this project will help us to keep records about all crimes and there details. So, it

will be easier to all the users also to the police stations to remove crime.

Page 53: Project Report

BIBLIOGRAPHY

MSDN Library Visual Studio 6.0a.

References from Ivan bayross part-1(HTML).

Microsoft Visual Studio-Wikipedia.

References from E Balagurusamy(Object oriented programming

C++).

References from Rajib Mall(Software Engineering).

Microsoft foundation class MSDN

Page 54: Project Report

CONTENTS

Chapter 1. Introduction

Chapter 2. Background & Concept

Chapter 3. Project Description

Chapter 4. Technical Design

Chapter 5. Implementation and Result

Conclusion

Bibliography