Anda di halaman 1dari 28

Credit Card Fraud Detection Using Hidden Markov Model Scope of the project To detect and block from

fraud transactions using a credit card. Introduction Credit-card-based purchases can be categorized into two types: 1) physical card and 2) irtual card. !n a physical-card based purchase" the cardholder presents his card physically to a merchant for making a payment. To carry out fraudulent transactions in this kind of purchase" an attacker has to steal the credit card. !f the cardholder does not realize the loss of card" it can lead to a substantial financial loss to the credit card company. !n the second kind of purchase" only some important information about a card #card number" e$piration date" secure code) is re%uired to make the payment. &uch purchases are normally done on the !nternet or o er the telephone. To commit fraud in these types of purchases" a fraudster simply needs to know the card details. 'ost of the time" the genuine cardholder is not aware that someone else has seen or stolen his card information. The only way to detect this kind of fraud is to analyze the spending patterns on e ery card and to figure out any inconsistency with respect to the (usual) spending patterns. *raud detection based on the analysis of e$isting purchase data of cardholder is a promising way to reduce the rate of successful credit card frauds. &ince humans tend to e$hibit specific beha iorist profiles" e ery cardholder can be represented by a set of patterns containing information about the typical purchase category" the time since the last purchase" the amount of money spent" etc. +e iation from such patterns is a potential threat to the system.

HMM BACK !"U#D ,n -''is a double embedded stochastic process with two hierarchy le els. !t can be used to model much more complicated stochastic processes as compared to a traditional 'arko model.,n-''has a finite set of states go erned by a set of transition probabilities. !n a particular state" an outcome or obser ation can be generated according to an associated probability distribution. !t is only the outcome and

not the state that is

isible to an e$ternal obser er. -''-based applications are ha e in estigated thecapabilities of-''in anomaly

common in arious areas such as speech recognition" bioinformatics" and genomics. !n recent years" .oshi and /hoba detection. They classify TC/ network traffic as an attack or normal using -''. Cho and /ark suggest an -''-based intrusion detection system that impro es the modeling time and performance by considering only the pri ilege transition flows based on the domain knowledge of attacks. 0urston etal. ha e proposed the application of -'' in detecting multistage network attacks. -oang et al. present a new method to process se%uences of system calls for anomaly detection using -''.The key idea is to build a multilayer model of program beha iors based on both -''s and enumerating methods for anomaly detection. 1ane has used -'' to model human beha ior. 0nce human beha ior is correctly modeled" any detected de iation is a cause for concern since an attacker is not e$pected to ha e a beha ior similar to the genuine user. -ence" an alarm is raised in case of any de iation. ,n -'' can be characterized by the following : 1. 2 is the number of states in the model. 3e denote the set of states & 4 f&15 &25 . . . &2g" where &i" i 4 15 25 . . .52 is an indi idual state. The state at time instant t is denoted by %t. 2. ' is the number of distinct obser ation symbols per state. The obser ation symbols correspond to the physical output of the system being modeled. 3e denote the set of symbols 6 4 f615 625 . . . 6'g" where 6i" i 4 15 25 . . .5' is an indi idual symbol.

$%isting S&ste'( !n case of the e$isting system the fraud is detected after the fraud is done that is" the fraud is detected after the complaint of the card holder. ,nd so the card holder faced a lot of trouble before the in estigation finish. ,nd also as all the transaction is maintained in a log" we need to maintain a huge data. ,nd also now a days lot of online purchase are made so we don7t know the person how is using the card online" we 8ust capture the !/ address for erification purpose. &o there need a help from the cyber crime to in estigate

the fraud. To a oid the entire abo e disad antage we propose the system to detect the fraud in a best and easy way. )roposed S&ste'( !n proposed system" we present a -idden 'arko 'odel #-'').3hich does not re%uire fraud signatures and yet is able to detect frauds by considering a cardholder7s spending habit. Card transaction processing se%uence by the stochastic process of an -''. The details of items purchased in !ndi idual transactions are usually not known to an *+& running at the bank that issues credit cards to the cardholders. -ence" we feel that -'' is an ideal choice for addressing this problem. ,nother important ad antage of the -''-based approach is a drastic reduction in the number of *alse /ositi es transactions identified as malicious by an *+& although they are actually genuine. ,n *+& runs at a credit card issuing bank. 9ach incoming transaction is submitted to the *+& for erification. *+& recei es the card details and the alue of purchase to erify" whether the transaction is genuine or not. The types of goods that are bought in that transaction are not known to the *+&. !t tries to find any anomaly in the transaction based on the spending profile of the cardholder" shipping address" and billing address" etc.

Hard*are !e+uire'ents &:&T9' -,=+ +!&> *10//: +=!69 '02!T0= '0B&9 =,' : /entium !6 2.; <-z : ;? <@ : 1.;; '@ : 1A 6<, colour : 1ogitech. : 2AC '@

Soft*are !e+uire'ents 0perating system *ront 9nd Coding 1anguage :- 3indows D/ /rofessional : - ,sp .2et 2.?. :- 6isual CE .2et

@ack-9nd Modules

: - &%l &er er 2??A.

,- #e* card .- /ogin 0- Securit& infor'ation 1- 2ransaction 3- 4erification Module Description #e* card !n this module" the customer gi es there information to enroll a new card. The information is all about there contact details. They can create there own login and password for there future use of the card. /ogin !n 1ogin *orm module presents site isitors with a form with username and password fields. !f the user enters a alid usernameFpassword combination they will be granted access to additional resources on website. 3hich additional resources they will ha e access to can be configured separately. Securit& infor'ation !n &ecurity information module it will get the information detail and its store7s in database. !f the card lost then the &ecurity information module form arise. !t has a set of %uestion where the user has to answer the correctly to mo e to the transaction section. !t contain informational pri acy and informational self-determination are addressed s%uarely by the in ention affording persons and entities a trusted means to user" secure" search" process" and e$change personal andFor confidential information. 2ransaction The method and apparatus for pre-authorizing transactions includes pro iding a communications de ice to a endor and a credit card owner. The credit card owner initiates a credit card transaction by communicating to a credit card number" and storing therein" a distinguishing piece of information that characterizes a specific transaction to be made by an authorized user of the credit card at a later time. The information is accepted as Gnetwork dataG in the data base only if a correct personal identification code

#/!C) is used with the communication. The Gnetwork dataG will ser e to later authorize that specific transaction. The credit card owner or other authorized user can then only make that specific transaction with the credit card. @ecause the transaction is preauthorized" the endor does not need to see or transmit a /!C.

4erification 6erification information is pro ided with respect to a transaction between an initiating party and a erification-seeking party" the erification information being gi en by a third" erifying party" based on confidential information in the possession of the erification the process will seeks card number and if the card initiating party. !n

number is correct the rele ant process will be e$ecuted. !f the number is wrong" mail will be sent to the user saying the card no has been block and he can7t do the further transaction. Module I5" #e* card <i en !nput- =e%uest from the user for the card. 9$pected 0utput-,ssigning an account to re%uested user. /ogin <i en !nput- <i e username and password of particular user. 9$pected 0utput- 1ogin to user7s account. Securit& infor'ation <i en !nput- <i e the security information by answering security %uestions. 9$pected 0utput-Bpdation of account with the security details. 2ransaction <i en !nput- <i e the account details and performs transaction. 9$pected 0utput- Bpdation of database. 4erification <i en !nput- Checks with user7s stored details like security answers or hidden details.

9$pected 0utput-!f the erification is success" user can perform transaction" else blocks the card.

/iterature revie* <hosh and =eilly ha e proposed credit card fraud detection with a neural network. They ha e built a detection system" which is trained on a large sample of labeled credit card account transactions. These transactions contain e$ample fraud cases due to lost cards" stolen cards" application fraud" counterfeit fraud" mail-order fraud" and nonrecei ed issue #2=!) fraud. =ecently" &yeda et al. ha e used parallel granular neural networks #/<22s) for impro ing the speed of data mining and knowledge disco ery process in credit card fraud detection. , complete system has been implemented for this purpose. &tolfo et al. suggest a credit card fraud detection system #*+&) using metalearning techni%ues to learn models of fraudulent credit card transactions. 'etalearning is a general strategy that pro ides a means for combining and integrating a number of separately built classifiers or models. , metaclassifier is thus trained on the correlation of the predictions of the base classifiers. The same group has also worked on a cost-based model for fraud and intrusion detection . They use .a a agents for 'etalearning #.,')" which is a distributed data mining system for credit card fraud detection. , number of important performance metrics like True /ositi eH*alse /ositi e #T/-*/) spread and accuracy ha e been defined by them. ,leskero et al. system" based on a neural learning module" pro ides an interface to a present ariety of C,=+3,TC-" a database mining system used for credit card fraud detection. The commercial databases. >im and >im ha e identified skewed distribution of data and mi$ of legitimate and fraudulent transactions as the two main reasons for the cmple$ity of credit card fraud detection . @ased on this obser ation" they use fraud density of real transaction data as a confidence alue and generate the weighted fraud score to reduce the number of misdetections. *an et al. suggest the application of distributed data mining in credit card fraud detection. @rause et al. ha e de eloped an approach that in ol es ad anced data mining techni%ues and neural network algorithms to obtain high fraud co erage. Chiu and Tsai ha e proposed 3eb ser ices and data mining techni%ues to establish a collaborati e scheme for fraud detection in the banking industry. 3ith this scheme" participating banks share knowledge about the fraud patterns in a

heterogeneous and distributed en ironment. To establish a smooth channel of data e$change" 3eb ser ices techni%ues such as D'1" &0,/" and 3&+1 are used. /hua et al. ha e done an e$tensi e sur ey of e$isting data-mining-based *+&s and published a comprehensi e report. /rodromidis and &tolfo use an agent-based approach with distributed learning for detecting frauds in credit card transactions. !t is based on artificial intelligence and combines inducti e learning algorithms and metalearning methods for achie ing higher accuracy. /hua .suggest the use of metaclassifier similar to infrauddetectionproblems.Theyconsidernai e@ayesian" C;.A" and @ack /ropagation neural networks as the base classifiers. , metaclassifier is used to determine which classifier should be considered based on skewness of data. ,lthough they do not directly use credit card fraud detection as the target application" their approach is %uite generic. 6atsa et al. ha e recently proposed a game-theoretic approach to credit card fraud detection. They model the interaction between anattackerandan*+&as a ltistagegamebetween two players" each trying to ma$imize his payoff. The problem with most of the abo ementioned approaches is that they re%uire labeled data for both genuine" as well as fraudulent transactions" to train the classifiers. <etting real-world fraud data is one of the biggest problems associated with credit card fraud detection. ,lso" these approaches cannot detect new kinds of frauds for which labeled data is not a ailable. !n contrast" we present a -idden 'arko 'odel #-'')-based credit card *+&" which does not re%uire fraud signatures and yet is able to detect frauds by considering a cardholder7s spending habit.3emodel a credit card transaction processing se%uence by the stochastic process of an -''. The details of items purchased in indi idual transactions are usually not known to an *+& running at the bank that issues credit cards to the cardholders. This can be represented as the underlying finite 'arko chain" which is not obser able. The transactions can only be obser ed through the other stochastic process that produces the se%uence of the amount of money spent in each transaction. -ence" we feel that -'' is an ideal choice for addressing this problem. ,nother important ad antage of the -''-based approach is a drastic reduction in the number of *alse /ositi es #*/s) Htransactions identified as malicious by an *+& although they are actually genuine. &ince the number of genuine transactions is a few orders of magnitude higher than the number of malicious transactions" an *+& should be designed in such a way that the number of */s is as low as possible.

2echni+ues and Algorith' Used HMM Model To map the credit card transaction processing operation in terms of an -''" we start by first deciding the obser ation symbols in our model.3e%uantize the purchase alues $ into ' price ranges 615 625 . . . 6'" forming the obser ation symbols at the issuing bank. The actual price range for each symbol is configurable based on the spending habit of indi idual cardholders. These price ranges can be determined dynamically by applying a clustering algorithm on the alues of each cardholder7s transactions" as shown in &ection A.2. 3e use 6k" k 4 15 25 . . .'" to represent both the obser ation symbol" as well as the corresponding price range. !n this work" we consider only three price ranges" namely" low #l)" medium #m)" and high#h). 0ur set of obser ation symbols is" therefore" 6 4 fl5 m5 hg making ' 4 I. *or e$ample" let lJ#?" K1??L" m J#K1??"KA??L" and hJ#KA??" credit card limitL. !f a cardholder performs a transaction of K1M?" then the corresponding obser ation symbol is m. , credit cardholder makes different kinds of purchases of different amounts o er a period of time. 0ne possibility is to consider the se%uence of transaction amounts and look for de iations in them. -owe er" the se%uence of types of purchase is more stable compared to the se%uence of transaction amounts. The reason is that" a cardholder makes purchases depending on his need for procuring different types of items o er a period of time. This" in turn" generates a se%uence of transaction amounts. 9ach indi idual transaction amount usually depends on the corresponding type of purchase. -ence" we consider the transition in the type of purchase as state transition in our model. The type of each purchase is linked to the line of business of the corresponding merchant. This information about the merchant7s line of business is not known to the issuing bank running the *+&. Thus" the type of purchase of the cardholder is hidden from the *+&. The set of all possible types of purchase and" e%ui alently" the set of all possible lines of business of merchants forms the set of hidden states of the -''. !t should be noted at this stage that the line of business of the merchant is known to the ac%uiring bank" since this information is furnished at the time of registration of a merchant. ,lso" some merchants may be dealing in arious types of commodities #*or e$ample" 3al-'art" >-'art" or Target sells tens of thousands of different items). &uch

types of line of business are considered as 'iscellaneous" and we do not attempt to determine the actual types of items purchased in these transactions. ,ny assumption about a ailability of this information with the issuing bank and" hence" with the *+&" is not practical and" therefore" would not ha e been alid.

Advantages -ighly &ecurity from unauthorized use of credit card 1. , oids fraud usage of card through online transactions. 2. +etect if card used by others if card lost. Applications

,ll the applications using credit cards. Screen Shot( #e* Card(

/ogin

2!A#SAC2I"#(

/=0+BCT !2*0:

B&9= /=0*!19:

&9CB=!T::

/A# UA $ D$SC!I)2I"# Active Server )ages-#$2

,&/.29T is a programming framework built on the common language runtime that can be used on a ser er to build powerful 3eb applications. ,&/.29T offers se eral important ad antages o er pre ious 3eb de elopment models:

$nhanced )erfor'ance- ,&/.29T is compiled common language runtime code running on the ser er. Bnlike its interpreted predecessors" ,&/.29T can take ad antage of early binding" 8ust-in-time compilation" nati e optimization" and caching ser ices right out of the bo$. This amounts to dramatically better performance before you e er write a line of code.

6orld7Class

2ool

Support-

The

,&/.29T

framework

is

complemented by a rich toolbo$ and designer in the 6isual &tudio integrated de elopment en ironment. 3:&!3:< editing" drag-and-drop ser er controls" and automatic deployment are 8ust a few of the features this powerful tool pro ides.

)o*er and Fle%i8ilit&- @ecause ,&/.29T is based on the common language runtime" the power and fle$ibility of that entire platform is a ailable to 3eb application de elopers. The .29T *ramework class library" 'essaging" and +ata ,ccess solutions are all seamlessly accessible from the 3eb. ,&/.29T is also language-independent" so you can choose the language that best applies to your application or partition your application across many languages. *urther" common language runtime interoperability guarantees that your e$isting in estment in C0'-based de elopment is preser ed when migrating to ,&/.29T.

Si'plicit&- ,&/.29T makes it easy to perform common tasks" from simple form submission and client authentication to deployment and site configuration. *or e$ample" the ,&/.29T page framework allows you to build user interfaces that cleanly separate application logic from presentation code and to handle e ents in a simple" 6isual @asic - like forms processing model. ,dditionally" the common language runtime simplifies de elopment" with managed code ser ices such as automatic reference counting and garbage collection.

Managea8ilit&-

,&/.29T

employs

te$t-based"

hierarchical

configuration system" which simplifies applying settings to your ser er

en ironment and 3eb applications. @ecause configuration information is stored as plain te$t" new settings may be applied without the aid of local administration tools. This Gzero local administrationG philosophy e$tends to deploying ,&/.29T *ramework applications as well. ,n ,&/.29T *ramework application is deployed to a ser er simply by copying the necessary files to the ser er. 2o ser er restart is re%uired" e en to deploy or replace running compiled code.

Scala8ilit& and Availa8ilit&- ,&/.29T has been designed with scalability in mind" with features specifically tailored to impro e performance in clustered and multiprocessor en ironments. *urther" processes are closely monitored and managed by the ,&/.29T runtime" so that if one misbeha es #leaks" deadlocks)" a new process can be created in its place" which helps keep your application constantly a ailable to handle re%uests.

Custo'i9a8ilit& and $%tensi8ilit&- ,&/.29T deli ers a well-factored architecture that allows de elopers to Gplug-inG their code at the appropriate le el. !n fact" it is possible to e$tend or replace any subcomponent of the ,&/.29T runtime with your own custom-written component. !mplementing custom authentication or state ser ices has ne er been easier.

Securit&- 3ith built in 3indows authentication and per-application configuration" you can be assured that your applications are secure.

/anguage Support The 'icrosoft .29T /latform currently offers built-in support for three languages: CE" 6isual @asic" and .&cript. 6hat is AS)-#$2 6e8 For's: The ,&/.29T 3eb *orms page framework is a scalable common language runtime programming model that can be used on the ser er to dynamically generate 3eb pages.

!ntended as a logical e olution of ,&/ #,&/.29T pro ides synta$ compatibility with e$isting pages)" the ,&/.29T 3eb *orms framework has been specifically designed to address a number of key deficiencies in the pre ious model. !n particular" it pro ides:
The ability to create and use reusable B! controls that can encapsulate

common functionality and thus reduce the amount of code that a page de eloper has to write.
The ability for de elopers to cleanly structure their page logic in an

orderly fashion #not Gspaghetti codeG).


The ability for de elopment tools to pro ide strong 3:&!3:< design

support for pages #e$isting ,&/ code is opa%ue to tools). ,&/.29T 3eb *orms pages are te$t files with an .asp$ file name e$tension. They can be deployed throughout an !!& irtual root directory tree. 3hen a browser client re%uests .asp$ resources" the ,&/.29T runtime parses and compiles the target file into a .29T *ramework class. This class can then be used to dynamically process incoming re%uests. #2ote that the .asp$ file is compiled only the first time it is accessed5 the compiled type instance is then reused across multiple re%uests). ,n ,&/.29T page can be created simply by taking an e$isting -T'1 file and changing its file name e$tension to .asp$ #no modification of code is re%uired). *or e$ample" the following sample demonstrates a simple -T'1 page that collects a userNs name and category preference and then performs a form postback to the originating page when a button is clicked: ,&/.29T pro ides synta$ compatibility with e$isting ,&/ pages. This includes support for OP PQ code render blocks that can be intermi$ed with -T'1 content within an .asp$ file. These code blocks e$ecute in a top-down manner at page render time.

Code7Behind 6e8 For's

,&/.29T supports two methods of authoring dynamic pages. The first is the method shown in the preceding samples" where the page code is physically declared within the originating .asp$ file. ,n alternati e approach--known as the code-behind method--enables the page code to be more cleanly separated from the -T'1 content into an entirely separate file. Introduction to AS)-#$2 Server Controls !n addition to #or instead of) using OP PQ code blocks to program dynamic content" ,&/.29T page de elopers can use ,&/.29T ser er controls to program 3eb pages. &er er controls are declared within an .asp$ file using custom tags or intrinsic -T'1 tags that contain a runat;<server< attribute alue. !ntrinsic -T'1 map tags to are of handled the by one is of the assigned controls the in type the of S&ste'-6e8-UI-Ht'lControls namespace. ,ny tag that doesnNt e$plicitly one controls S&ste'-6e8-UI-Ht'lControls-Ht'l enericControl . &er er controls automatically maintain any client-entered alues between round trips to the ser er. This control state is not stored on the ser er #it is instead stored within an =input t&pe;<hidden<> form field that is round-tripped between re%uests). 2ote also that no client-side script is re%uired. !n addition to supporting standard -T'1 input controls" ,&/.29T enables de elopers to utilize richer custom controls on their pages. *or e$ample" the following sample demonstrates how the =asp(adrotator> control can be used to dynamically display rotating ads on a page. 1. ,&/.29T 3eb *orms pro ide an easy and powerful way to build dynamic 3eb B!. 2. ,&/.29T 3eb *orms pages can target any browser client #there are no script library or cookie re%uirements). I. ,&/.29T 3eb *orms pages pro ide synta$ compatibility with e$isting ,&/ pages. ;. ,&/.29T ser er controls pro ide an easy way to encapsulate common functionality.

A. ,&/.29T ships with ;A built-in ser er controls. +e elopers can also use controls built by third parties. C. ,&/.29T ser er controls can automatically pro8ect both uple el and downle el -T'1. R. ,&/.29T templates pro ide an easy way to customize the look and feel of list ser er controls. S. ,&/.29T alidation controls pro ide an easy way to do declarati e client or ser er data alidation.

Cr&stal !eports Crystal =eports for 6isual @asic .29T is the standard reporting tool for 6isual @asic.29T5 it brings the ability to create interacti e" presentation-%uality content H which has been the strength of Crystal =eports for years H to the .29T platform. 3ith Crystal =eports for 6isual @asic.29T" you can host reports on 3eb and 3indows platforms and publish Crystal reports as =eport 3eb &er ices on a 3eb ser er. To present data to users" you could write code to loop through recordsets and print them inside your 3indows or 3eb application. -owe er" any work beyond basic formatting can be complicated: consolidations" multiple le el totals" charting" and conditional formatting are difficult to program. 3ith Crystal =eports for 6isual &tudio .29T" you can %uickly create comple$ and professional-looking reports. !nstead of coding" you use the Crystal =eport +esigner interface to create and format the report you need. The powerful =eport 9ngine processes the formatting" grouping" and charting criteria you specify. !eport $%perts

Bsing the Crystal =eport 9$perts" you can %uickly create reports based on your de elopment needs:

Choose from report layout options ranging from standard reports to form letters" or build your own report from scratch. +isplay charts that users can drill down on to iew detailed report data. Calculate summaries" subtotals" and percentages on grouped data. &how Top2 or @ottom2 results of data. Conditionally format te$t and rotate te$t ob8ects.

AC2I4$ ? DA2A "B@$C2S-#$2 AD"-#$2 "vervie*

,+0.29T is an e olution of the ,+0 data access model that directly addresses user re%uirements for de eloping scalable applications. !t was designed specifically for the web with scalability" statelessness" and D'1 in mind. ,+0.29T uses some ,+0 ob8ects" such as the Connection and Co''and ob8ects" and also introduces new ob8ects. >ey new ,+0.29T ob8ects include the DataSet" Data!eader" and DataAdapter. The important distinction between this e ol ed stage of ,+0.29T and pre ious data architectures is that there e$ists an ob8ect -- the DataSet -- that is separate and distinct from any data stores. @ecause of that" the DataSet functions as a standalone entity. :ou can think of the +ata&et as an always disconnected recordset that knows nothing about

the source or destination of the data it contains. !nside a DataSet" much like in a database" there are tables" columns" relationships" constraints" iews" and so forth. , DataAdapter is the ob8ect that connects to the database to fill the DataSet. Then" it connects back to the database to update the data there" based on operations performed while the DataSet held the data. !n the past" data processing has been primarily connection-based. 2ow" in an effort to make multi-tiered apps more efficient" data processing is turning to a message-based approach that re ol es around chunks of information. ,t the center of this approach is the DataAdapter" which pro ides a bridge to retrie e and sa e data between a DataSet and its source data store. !t accomplishes this by means of re%uests to the appropriate &T1 commands made against the data store. The D'1-based DataSet ob8ect pro ides a consistent programming model that works with all models of data storage: flat" relational" and hierarchical. !t does this by ha ing no NknowledgeN of the source of its data" and by representing the data that it holds as collections and data types. 2o matter what the source of the data within the DataSet is" it is manipulated through the same set of standard ,/!s e$posed through the DataSet and its subordinate ob8ects. 3hile the DataSet has no knowledge of the source of its data" the managed pro ider has detailed and specific information. The role of the managed pro ider is to connect" fill" and persist the DataSet to and from data stores. The 019 +@ and &T1 &er er .29T +ata /ro iders #&ystem.+ata.0le+b and &ystem.+ata.&%lClient) that are part of the .2et *ramework pro ide four basic ob8ects: the Co''and" Connection" Data!eader and DataAdapter. !n the remaining sections of this document" weNll walk through each part of the DataSet and the 019 +@F&T1 &er er .29T +ata /ro iders e$plaining what they are" and how to program against them. The following sections will introduce you to some ob8ects that ha e e ol ed" and some that are new. These ob8ects are:

Connections. *or connection to and managing transactions against a database. Co''ands. *or issuing &T1 commands against a database.

Data!eaders. *or reading a forward-only stream of data records from a &T1 &er er data source. DataSets. *or storing" remoting and programming against flat data" D'1 data and relational data. DataAdapters. *or pushing data into a DataSet" and reconciling data against a database.

3hen dealing with connections to a database" there are two different options: &T1 &er er .29T +ata /ro ider #&ystem.+ata.&%lClient) and 019 +@ .29T +ata /ro ider #&ystem.+ata.0le+b). !n these samples we will use the &T1 &er er .29T +ata /ro ider. These are written to talk directly to 'icrosoft &T1 &er er. The 019 +@ .29T +ata /ro ider is used to talk to any 019 +@ pro ider #as it uses 019 +@ underneath). Connections Connections are used to Ntalk toN databases" and are respresented by pro ider-specific classes such as SA/Connection. Commands tra el o er connections and resultsets are returned in the form of streams which can be read by a Data!eader ob8ect" or pushed into a DataSet ob8ect. Co''ands Commands contain the information that is submitted to a database" and are represented by pro ider-specific classes such as SA/Co''and. , command can be a stored procedure call" an B/+,T9 statement" or a statement that returns results. :ou can also use input and output parameters" and return alues as part of your command synta$. The e$ample below shows how to issue an !2&9=T statement against the #orth*ind database. Data!eaders The Data!eader ob8ect is somewhat synonymous with a read-onlyFforward-only cursor o er data. The Data!eader ,/! supports flat as well as hierarchical data. , Data!eader ob8ect is returned after e$ecuting a command against a database. The format of the returned Data!eader ob8ect is different from a recordset. *or e$ample" you might use the Data!eader to show the results of a search list in a web page.

DataSets and DataAdapters DataSets The DataSet ob8ect is similar to the ,+0 !ecordset ob8ect" but more powerful" and with one other important distinction: the DataSet is always disconnected. The DataSet ob8ect represents a cache of data" with database-like structures such as tables" columns" relationships" and constraints. -owe er" though a DataSet can and does beha e much like a database" it is important to remember that DataSet ob8ects do not interact directly with databases" or other source data. This allows the de eloper to work with a programming model that is always consistent" regardless of where the source data resides. +ata coming from a database" an D'1 file" from code" or user input can all be placed into DataSet ob8ects. Then" as changes are made to the DataSet they can be tracked and erified before updating the source data. The etChanges method of the DataSet ob8ect actually creates a second DatSet that contains only the changes to the data. This DataSet is then used by a DataAdapter #or other ob8ects) to update the original data source. The DataSet has many D'1 characteristics" including the ability to produce and consume D'1 data and D'1 schemas. D'1 schemas can be used to describe schemas interchanged ia 3eb&er ices. !n fact" a DataSet with a schema can actually be compiled for type safety and statement completion. DataAdapters B"/$DB5SA/C The DataAdapter ob8ect works as a bridge between the DataSet and the source data. Bsing the pro ider-specific S+lDataAdapter #along with its associated S+lCo''and and S+lConnection) can increase o erall performance when working with a 'icrosoft &T1 &er er databases. *or other 019 +@-supported databases" you would use the "leD8DataAdapter ob8ect and its associated "leD8Co''and and "leD8Connection ob8ects. The DataAdapter ob8ect uses commands to update the data source after changes ha e been made to the DataSet. Bsing the Fill method of the DataAdapter calls the &919CT command5 using the Update method calls the !2&9=T" B/+,T9 or +919T9 command for each changed row. :ou can e$plicitly set these commands in order to control the statements used at runtime to resol e changes" including the use of stored

procedures. *or ad-hoc scenarios" a Co''andBuilder ob8ect can generate these at run-time based upon a select statement. -owe er" this run-time generation re%uires an e$tra round-trip to the ser er in order to gather re%uired metadata" so e$plicitly pro iding the !2&9=T" B/+,T9" and +919T9 commands at design time will result in better run-time performance. 1. ,+0.29T is the ne$t e olution of ,+0 for the .2et *ramework. 2. ,+0.29T was created with n-Tier" statelessness and D'1 in the forefront. Two new ob8ects" the DataSet and DataAdapter" are pro ided for these scenarios. I. ,+0.29T can be used to get data from a stream" or to store data in a cache for updates. ;. There is a lot more information about ,+0.29T in the documentation. A. =emember" you can e$ecute a command directly against the database in order to do inserts" updates" and deletes. :ou donNt need to first put data into a DataSet in order to insert" update" or delete it. C. ,lso" you can use a DataSet to bind to the data" mo e through the data" and na igate data relationships

2$S2I#

A#D IM)/$M$#2A2I"#

2$S2I# ( Testing is a process of e$ecuting a program with a intent of finding an error. Testing presents an interesting anomaly for the software engineering. The goal of the software testing is to con ince system de eloper and customers that the software is good enough for operational use. Testing is a process intended to build confidence in the software. Testing is a set of acti ities that can be planned in ad ance and conducted systematically. Testing is a set of acti ities that can be planned in ad ance and conducted systematically. &oftware testing is often referred to as erification U alidation.

2D)$ "F 2$S2I# ( The arious types of testing are 3hite @o$ Testing @lack @o$ Testing ,lpha Testing @eta Testing 3in =unner ,nd 1oad =unner Bnit Testing &ystem Testing 6HI2$ B"? 2$S2I# ( !t is also called as glass-bo$ testing. !t is a test case design method that uses the control structure of the procedural design to deri e test cases. Bsing white bo$ testing methods" the software engineer can deri e test cases that 1. 2. <uarantee that all independent parts within a module ha e been 9$ercise all logical decisions on their true and false sides. e$ercised at least once"

B/ACK B"? 2$S2I# ( !ts also called as beha ioral testing . !t focuses on the functional re%uirements of the software. !t is complementary approach that is likely to unco er a . different class of errors than white bo$ errors. , black bo$ testing enables a software engineering to deri e a sets of input conditions that will fully e$ercise all functional re%uirements for a program. A/)HA 2$S2I# ( ,lpha testing is the software prototype stage when the software is first able to run. !t will not ha e all the intended functionality" but it will ha e core functions

and will be able to accept inputs and generate outputs. ,n alpha test usually takes place in the de eloperNs offices on a separate system. B$2A 2$S2I# ( The beta test is a ( li e ( application of the software in an en ironment that cannot be controlled by the de eloper. The beta test is conducted at one or more customer sites by the end user of the software. 6I# !U##$! E /"AD !U##$!( 3e use 3in =unner as a load testing tool operating at the <B! layer as it allows us to record and playback user actions from a ast ariety of user applications as if a real user had manually e$ecuted those actions. /"AD !U##$! 2$S2I# ( 3ith 1oad =unner " you can 0btain an accurate picture of end-to-end system performance. 6erify that new or upgraded applications meet specified performance re%uirements. 2$S2I# US$D I# 2HIS )!"@$C2( ( Testing of the debugging programs is one of the most critical aspects of the computer programming triggers" without programs that works" the system would ne er produce the output for which it was designed. Testing is best performed when user de elopment are asked to assist in identifying all errors and bugs. The sample data are used for testing . !t is not %uantity but %uality of the data used the matters of testing. Testing is aimed at ensuring that the system was accurately an efficiently before li e operation commands. 4A/IDA2I"# 2$S2I# ( software is completely assembled as a package" interfacing error ha e been unco ered and corrected and a final series of software tests. That is" alidation tests begin" alidation testing can be defined many ways but a simple definition is that alidation succeeds when the software functions in manner that can be reasonably e$pected be the customer. -ere all the alidations gi en to the design is completely checked.

SDS2$M 2$S2I#

Table design: +atabase 2ame: Tab 10<!2: Column 2ame Bname pwd roll uid +ata Type 6archar#2A) 6archar#2A) 6archar#A) int

#93 C,=+: Column 2ame Card2o Credit1imit holder2ame -older,ddress @ank2ame ,C20 +ata Type archar#1C) int archar#A?) archar#1??) archar#A?) archar#2A)

#93 C,=+ !2*0=',T!02: Column 2ame *irst2ame 1ast2ame Bid B2ame pwd 9mail +0@ <ender +ata Type archar#2A) archar#2A) !nt archar#2A) archar#2A) archar#2A) datetime archar#C)

address1 address2 city state country pincode phone card2o

archar#A?) archar#A?) archar#2A) archar#2A) archar#2A) int int archar#1C)

&9CB=!T: !2*0=',T!02: Column 2ame uid &ecTues1 &ec,nswer1 &ecTues2 &ec,nswer2 &ecTuesI &ec,nswerI &ecTues; &ec,nswer; &ecTuesA &ec,nswerA 9mail +0@ gender +ata Type int archar#A?) archar#A?) archar#A?) archar#A?) archar#A?) archar#A?) archar#A?) archar#A?) archar#A?) archar#A?) archar#2A) datetime archar#C)

,CC0B2T !2*0=',T!02: Column 2ame Card2o -older2ame -older,ddress ,c2o @ank2ame +ata Type archar#1C) archar#A?) archar#1??) archar#2A) archar#A?)

/laceofTransaction /lace!d ,mount +ateTime

archar#A?) int int datetime

/=0+BCT 1!&T: Column 2ame /ro!d p2ame p=ate pTty pTotal +ata Type int archar#1??) float int float

/=0+BCT !2*0=',T!02: Column 2ame p2ame p=ate +ata Type archar#1??) float

Anda mungkin juga menyukai