• Save
Gui stud
Upcoming SlideShare
Loading in...5
×
 

Gui stud

on

  • 312 views

GUI lab manual for SEIT

GUI lab manual for SEIT

Statistics

Views

Total Views
312
Views on SlideShare
312
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Gui stud Gui stud Document Transcript

  • K. J. Somaiya Institute of Engineering & Information Technology K. J. Somaiya Institute of Engineering And Information Technology Sion, Mumbai - 22 Department: Information Technology Academic year: 2011-12 Lab Manual Class - SE Sem - III SUBJECT: GUI AND DATABASE MANAGEMENT Version: 2Department of Information Technology/GUI & DBM(Sem: III) Page 1
  • K. J. Somaiya Institute of Engineering & Information Technology K.J.SOMAIYA INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY CLASS: S.E. SEMESTER: III SUBJECT: GUI AND DATABASE MANAGEMENT_____________________________________________________________________ List of Experiments 1. ER model and reduction of ER model to relational model. 2. Implementation of database using SQL server 3. Modification of database schema 4. Implementation simple SQL queries 5. Implementation of advanced SQL queries 6. Implementation of Joins 7. Implementation of Views 8. Layout of GUI & Study of various controls used in VB 6.0 9. Implementation of GUI using VB 6.0, Business logic development 10. Database connectivity and working module Seema Yadav Subject InchargeDepartment of Information Technology/GUI & DBM(Sem: III) Page 2
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:1Aim: ER model and reduction of ER model to relational model.Software used: MS word.Theory : Entity relationship model is a data model which represent the overall logical structure ofdatabase and it is very useful in mapping the meanings and interactions of real world enterprisesonto a conceptual schema.The E-R model employs three basic notations:Entity sets: An entity set is a set of entities of the same type that share the same properties .(anentity is a real world object)Relationship sets: Relationship set is a set of relationships of the same type.(relationship is anassociation among several entities)Attributes: Attributes are properties of entity set used to describe it.Different types of attributes are as follows:1. Simple and composite attributes. In our examples thus far, the attributes have been simple;that is, they are not divided into subparts. Composite attributes,on the other hand, can be dividedinto subparts (that is, other attributes). For example, an attribute name could be structured as acomposite attribute consistingof first-name, middle-initial, and last-name. Using compositeattributes in a design schema is a good choice if a user will wish to refer to an entire attribute onsome occasions, and to only a component of the attribute on other occasions. Suppose we were tosubstitute for the customer entity-set attributes customer-street and customer-city the compositeattribute address with the attributesstreet, city, state, and zip-code.2 Composite attributes help us to grouptogether related attributes, making the modeling cleaner2. Single-valued and multivalued attributes. The attributes in our examples all have a single valuefor a particular entity. For instance, the loan-number attribute for a specific loan entity refers toonly one loan number. Such attributes are said to be single valued. There may be instances wherean attribute has a set of values for a specific entity. Consider an employee entity set with theattribute phone-number. An employee may have zero, one, or several phone numbers, anddifferent employees may have different numbers of phones. This type of attribute is said to bemultivalued.3. Derived attribute. The value for this type of attribute can be derived from the values of otherrelated attributes or entities. For instance, let us say that the customer entity set has an attributeloans-held, which represents how many loans a customer has from the bank. We can derive thevalue for this attribute by counting the number of loanDepartment of Information Technology/GUI & DBM(Sem: III) Page 3
  • K. J. Somaiya Institute of Engineering & Information Technologyentities associated with that customer. As another example, suppose that the customer entity sethas an attribute age, which indicates the customer’s age. If the customer entity set also has anattribute date-of-birth, we can calculate age from date-of-birth and the current date. Thus, age is aderived attribute. In this case, date-of-birth may be referred to as a base attribute, or a storedattribute. The value of a derived attribute is not stored, but is computed when required.In extended E R model we have three additional concepts:Specialization: The process of designating the subgroupings within an entity set is calledspecialization( finding specialized attributes)e.g. in entity set person we have two types of entities like customer and employee. Both areperson but employee have specialized attribute salary and customer have rating.Generalization: It is a top down design process in which multiple entity sets are synthesized intoa higher level entirty set on the basis of common features.e.g. customer entity set and employee entity set both have common attributes like name, address,age which can be used as attributes of higher level entity set person.Aggregation : it is an abstraction through which relationships are treated as higher level entities.The most important use of the E-R diagram is it represents some constraints like total and partialpraticiplation , one to one, many to many, many to one, one to many mapping etc.Department of Information Technology/GUI & DBM(Sem: III) Page 4
  • K. J. Somaiya Institute of Engineering & Information TechnologySymbols used in E R diagram: E Entity set A Attribute E A Multivalued attribute Weak entity set A R Derived attribute Relationship set A Primary key A R Partial key Identitying relationship set Composite AttributeMany to one cardinality A R Total participationOne to many cardinality R R Partial participation ROne to one cardinality R Specialization or generalizationmany to many cardinality ISA RDepartment of Information Technology/GUI & DBM(Sem: III) Page 5
  • K. J. Somaiya Institute of Engineering & Information TechnologyReducing ER model into relational model. 1) Any strong entity set E having attributes a1, a2,…,an is reduced into a relation schema called E with n distinct attributes i.e. a separate relation with name E and n distinct coloumns. 2) Any weak entity set A having attrinutes a1, a2,..n and a strong entity set B on which A depends, having primary key attributes as b1, b2, …, bn is reduced into a relation schema called A with one attribute for each member of set { a1, a2,…, an} U {b1, b2, ……. , bm} 3) Any relationship set R having a1,a2,…,an as a set of attributes formed by union of the primary keys of each of the entity sets participating in R and b1, b2,….,bm as set of descriptive attributes is reduced into a relation schema called R with one attribute for each member of the set {a1, a2, …. ,an} U {b1, b2, …., bn} Primary key of relationship set is decided as follows For binary many to many relationships the union of primary key attributes from the participating entity sets is primary ey. For binary one to one relationship set the primary key of either of the participating entity set can be chosen as the primary key. For binary many to one or one to many relationship set the primary key of the entity set on the many side of the relationship set serves as the primary key. For n-ary relationship sets without any arrows on its edges, union of the primary key attributes of participating entity sets is a primary key. For n-ary relationship sets with an arrows on one of its edges, union of the primary key attributes of participating entity sets is a primary key. To remove redundancy we generally make separate relation schema for many to many relationship set with primary key and other attributes as mentioned above. For one to one we combine relation schema of relationship set with relation schema of either sides of entity sets relation schema. For one to many and many to one we combine relation schema of relationship set with relation schema of entity set on many side entity set. We don’t make separate relation schema for identifying relationship set.Department of Information Technology/GUI & DBM(Sem: III) Page 6
  • K. J. Somaiya Institute of Engineering & Information Technology Every composite attribute A having subparts a1, a2,…,an is represented by separate column for each subpart in relation schema of the associated entity set. For multivalued attribute separate schema is form having columns as attributes of primary key of associated entity set and a column for multivalued attribute For disjoint generalization/specialization create separate relation schemas only for every lower level entity set(higher level entity set’s attributes are inherited so add columns for same) and not for higher level entity set. For overlapping generatlization/specialization create separate relation schemas for higher level as well as lower level entity sets. Also include the foreign key constraint in lower level entity set for the primary key attributes of higher level entity set. No separate relation is required to represent the aggregation the relation created from the defining relationship is used instead (design schema for relationship set treated as entity set carefully)Conclusion: Hence we have studied the ER data model consisting of a set of basic objects calledentities & relations among those objects.It is intended primarily for database design process byfollowing the specification.Reference book: Database System and conceptsAuthor: Henry F.Korth,Sliberchartz ,SudarshanPublication: Tata McGraw HillDepartment of Information Technology/GUI & DBM(Sem: III) Page 7
  • K. J. Somaiya Institute of Engineering & Information TechnologyDepartment of Information Technology/GUI & DBM(Sem: III) Page 8
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:- 2Aim : To implement the database using relational model design in experiment 1 . Creation of Database with proper constraints( Pk, Fk etc). Data Insertion into Database using insert statement(at least 5 records per table). Applying different constraints- check , unique, not null etc. Drop table.Resources Used : Windows Xp professional, MY SQL .Theory : After design of relational schema next step is to implement the database on machineusing Ms. SQL Server 2000.Implemention can be done using SQL queries or enterprise manager.Implementation Using Queries:To create database use query. create database database_name;Now database is created successfully . To use it use query use database_name;To create relation in this database use query create table table_name( attribute_name 1 domain, attribute_name 2 domain, attribute_name 3 domain [not null], . . . attribute_name n domain, [ constr_pk1: primary key( list of required and above defined attributes),] [constr_fk1: foreign key (attribute_name) references referenced_table_name,] [constr_ck1; check( attribute_name comparison_operator constant),] [constr_ck2:Department of Information Technology/GUI & DBM(Sem: III) Page 9
  • K. J. Somaiya Institute of Engineering & Information Technology check(attribute_name in (list of string or numeric constants),] [constr_uq1: unique(attribute_name)] );Various Domains available are;char(n) for a string with exactly n charactersvarchar(n) for a string with n or less than n charactersint for integer valuesdatetime for date and time related values ( ‘mm/dd/yyyy hh:mm:ss’ )Now relation/table is created(empty initially). To populate relation with tuples use insert into relation_name values( attribute_name1_value, attribute_name1_value,…………………,attribute_name _value);*put string values in single quotesConclusion: In this experiment concepts of various integrity constraints and DDL for creation ofnew relation is studied. Using it a database is implemented actually.Reference book: Database System and conceptsAuthor: Henry F.Korth,Sliberchartz ,SudarshanPublication: Tata McGraw HillProgram :Output:Department of Information Technology/GUI & DBM(Sem: III) Page 10
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:- 3Aim : To modify Data Definition (schema) of the database created. 1) Add column, remove column using alter table query 2) Show schema of any table(SP-help). 3) Add constraint, drop constraint explicitly(like check , unique, not null etc.) using alter table queryResources Used : Windows Xp professional, MY SQL.Theory : Once the database design is finalized and database is implement actually we alterschema of the database infrequently or never. According to changes in the requirements of thedatabase users we may need to change schema.Change in database schema mainly includes addition of new attributes to existing relation schemaor deletion of the existing attributes of the relation schema. Sometimes we need to include someaddition constraints on relation or may need to remove some existing constraintsTo see whether these changes are reflected in database schema we can use command SP_helprelation_name.This command gives details of the specified relation.Alter command is used to add column , remove column, add constraint and remove constraints.To add new column(attribute) A to relation R alter table R add A domaintype;As a result of this query a new column with name A is added to relation R with null values forexisting tuples in relation R for newly added column.To remove existing column A from relation R alter table R drop column A;Column A as a whole will be deleted from relation R.To add new constraint with name C1 to relation R alter table R add constraint C1 description_of_constraint;To drop existing constraint C1 alter table R drop constraint C1;Conclusion: Once designed , database schema changes infrequently. In case change is requiredthen we can use above DDL command to alter it.Department of Information Technology/GUI & DBM(Sem: III) Page 11
  • K. J. Somaiya Institute of Engineering & Information TechnologyReference book: Database System and conceptsAuthor: Henry F.Korth,Sliberchartz ,SudarshanPublication: Tata McGraw HillProgram:Output:Department of Information Technology/GUI & DBM(Sem: III) Page 12
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:- 4Aim : To implement simple SQL queries( Single table retrieval ) Make use of different operators (relational, logical etc) Selection of rows, columns, renaming columns, use of distinct keyword String Handling(%, - , like)Resources Used : Windows Xp professional, MY SQLTheory : After the database is populated with data next is data manipulation which includesmainly retriving and modifying the data in database.We can retrive one or more columns from relation. Also we can rename the columns in therelation. Based on specific condition we can retrive set of rows from relation.Basic structure of simple SQL query is. select A1,A2,…….., An from R where PIn select clause we list required column names. If we need all columns in relation then use just *(i.e. select * from R where P).In from clause we just list relation names from which we are selecting attributes mentioned inselect clause.In where clause we mention the predicate which is tested on every tuple of relations specified infrom clause.For generating simple predicate we use names of the attributes and the relational operators like < ,> , =, <= , >= etc. and to generate the complex predicate we use logical operators as connectivelike and , or with simple predicates.Renaming attributes using as clauseIn the select clause we can rename one or more attributes using as clause.select A1 , A2 as new_namea3, A3,A4 as new_namea4 from R where PKeyword distinctdistinct keyword is used to eliminate duplicate values in resultant relationselect distinct attribute_name from Rstring operations using like operatorIn this a pattern generated using two special characters % and _ is used with like operatorDepartment of Information Technology/GUI & DBM(Sem: III) Page 13
  • K. J. Somaiya Institute of Engineering & Information Technologyselect * from employee where fname like C%Upadating database:We can update a specific attributes value for specific or all tuples using update clause.alter table R set fname=’jone’ where ssn=’emp0001’for conditional update we can use case updateupdate R set salary= when salary>10000 then salary*1.06 else salary*1.05 endConclusion: In this program various single table retrival queries are executed on relations ofcompany database. Use of various operators present is SQL is studied.Reference book: Database System and conceptsAuthor: Henry F.Korth,Sliberchartz ,SudarshanPublication: Tata McGraw HillProgram:Output :Department of Information Technology/GUI & DBM(Sem: III) Page 14
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:- 5Aim : To write advanced queries in SQL using Group by, having clause, aggregate functions like sum, max, min, avg, count. Set operations like union, union all, order by clause etc. Nested queries using not in, in, not exists, exists, any, all etc.Resources Used : Windows Xp professional, Ms. SQL Server 2000Theory : We can write advanced queries in SQL using the various constructs like union, orderby, not in, not exists, exists, max, min, having clause.Union and union all operation:This operation combines the result of two or more queries into a single result set consisting of allthe rows belonging to all queries in the union.Syntax:Select a1, a2, a3, ……….,an from R1 union select b1, b2, b3,………,bn from R2R1 and R2 are two compatible relations. Compatibility here means arity of both the relations issame and also domain of ai must match with domain of bi for i=1, 2,3,……..n.In union operation all the duplicates are eliminated and if we want to retain the duplicates the useunion all in place of union.Order by clause:Order by clause is used to sort the tuples in given relation in either ascending or descending orderbased on the value of one or more attributes present in that relation. The default order isascending order. If we want to sort relation in descending order use keyword desc(use keywordasc explicitly to sort relation in ascending order ).Syntax:Select a1, a2, ……..,an from R order by a2 desc;Select a1, a2, ……,an from R order by a1 [asc];Select a1, a2,……..,an from R order by a1 asc a2 desc;In third example tuples in R are sorted in ascding order of values of a1. If two or more tupleshave same value for a1 then the are sorted in descing order of value of a2.Group by clause:Group by clause is used to group the rows of the relation based on a certain condition.Group by isusually used in conjuction with the aggregate functions like sum, ag, min, max etc.For example one can group the rows in book relation based on the authors name.Select book_name, price, subject from book group by author.Department of Information Technology/GUI & DBM(Sem: III) Page 15
  • K. J. Somaiya Institute of Engineering & Information TechnologyHaving clause:Having clause tells SQL to include only certain groups produced by the group by caluse in thequery result set. Having clause is equivalent to the where clause and is used to sqecity the searchcriteria or search condition where group by clause is specified.For example to select the names of the author who has written more than 3 books from bookrelation.Select author from book group by author having count(book-id) >3;Aggregate functions:Aggregate functions are the functions that take a collection of values as input and returns a singlevalue. SQL offers five bullt in aggregate functions.Average:avg([distinct | all] n)returns average values of n, ignoring all null values.Minimum:min ([distinct | all] n)returns minimum value of n.Maximum:max([distinct | all] n)returns a maximum value of nTotal:sum([distinct | all] n)return sum of all values of n.count: count([distinct | all] n)returns the number of rowes where n is not null.Nested subqueries:in:The in connective tests for the set membership, where the set is a collection of values produced bya select clause.For example to select details of the books written by r.p.jain and d.perry useselect book_id, book_name,price from book where author in(‘r.p.jain’, ‘d. perry’,’godse’);not in:This connective tests for absence of the set membership.For example to select details of the books written by authors other than r.p.jain and d.perry useselect book_id, book_name,price from book where author not in(‘r.p.jain’, ‘d. perry’,’godse’);Department of Information Technology/GUI & DBM(Sem: III) Page 16
  • K. J. Somaiya Institute of Engineering & Information Technologyall:this keyword is basically used in set comparison query.It is used in association with relational operators.“> all” corresponds to the phrase ‘greater than all’.For example to display details of the book that have price greater than all the books published inyear 2000 use.Select book_id, book_name, price from book where price >all (select price from book wherepub_year=’2000’);any or some:These keywords are used with relational operators in where clause of set comparison query.“=some” is identical to in and “<>some” is identical to not in.“>any “ is nothing but ‘greater than at least one’.exists and not exists:exists is the test for non empty set. It is represented by an expression of the form ‘exists (select……. From …….) ‘. Such expression evaluates to true only if the result evaluating the sub queryrepresented by the (select ……. From ……) is non empty.for example to select names of the books for which order is placed useselect book_name from book where exists( select * from order wherebook.book_id=order.book_id);not exists tests for empty set. For this the subquery must return empty set.Conclusion: In many cases data is needed to be obtained from more than one relations based oncertain conditions that time we can use advanced queries.Reference book: Database System and conceptsAuthor: Henry F.Korth,Sliberchartz ,SudarshanPublication: Tata McGraw HillProgram :Output :Department of Information Technology/GUI & DBM(Sem: III) Page 17
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No: 6Aim: To implement Joins.Software required: MYSQL/SQL server/OracleTheory:Introduction to joins A join can be defined as an operation that includes retrieval of data from more than one tableat a time.A join is a query that combines columns from two or more sources. Effectively you arereversing non less decomposition process used to normalize the database pulling related data backtogether in a combined result. Technically you can only join two sources ,such as two tables.When you need to join moresources you can do it in by joining two tables and then join the result with the the third table andso on. 1) Inner Join: Data from multiple table is displayed after comparing values present in common column. Eg: select spname,custname from salesreps join customer on(salesreps.spnum = customer.spnum) 2) Outer Join:result contains all rows from one table and matching rows from another table. Eg: select spname,custname from salesreps left outer join customer on (salesreps.spnum = customer.spnum) In this query ,rows from salesreps table are returned whether or not they qualify. This isbecause we specify left outer join. The left is in reference to join and salesreps table is or left side of equality operator.Thes arematched to NULL values for columns in right ( customer) table. If you execute this as right outer join,difference is that unqualified rows in the right (if any)would be returned by query. 3) Equi Join: It displays redundant columns data in result set where two or more tables are compared for equality. Eg:select emp.name as employeename,mgr.name as managername from employee emp join employeemgr where emp.managerno = mgr.managerno;Conclusion: Thus we have implemented joins in SQL and studied that join operation take tworelations and returns another relation as result. Inner join, outer join, equi join and self join arevarious types of joins.Department of Information Technology/GUI & DBM(Sem: III) Page 18
  • K. J. Somaiya Institute of Engineering & Information TechnologyReference book: Database System and conceptsAuthor: Henry F.Korth,Sliberchartz ,SudarshanPublication: Tata McGraw HillOutput:Department of Information Technology/GUI & DBM(Sem: III) Page 19
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No: 7 Aim: Implementing Views Software Required : MYSQL,ORACLE or SQL Server Theory: Introduction to views: SQL introduced concept of views as a means of providing a user with a personalized model of database. A view can hide data that a user does not need to see.The ability of views to hide data serves both to simplify usage because they restrict system and to hence enhance security. Views simplify system usage because they restrict user attention to data of interest.Although a user may be denied access to a relation that user may be allowed to access part of that relation through a view. Thus combination of relational level security and view-level security limits user’s access to precisely data that user needs. 1) Creating Views: A view can be created using create view statement. Eg.A clerk need to know names of all customers who have a loan at each branch.This clerk is not authorized to see information regarding specific loans that customer may have. Create view cust_loan as (select branch_name,customer_name From borrower,loan Where borrower.loan_number=loan.loan_number) 2) Altering views: A view can be altered using alter view statement. Eg. Update employee set target =600000 where city =’newyork’; Select * from employee; 3) Dropping view: A view can be dropped from database using drop view statement. Eg. Drop view student; Select * from student; Table:student does not exist. 4) Modifying data through views: It is possible to modify data in base table by modyfying data in view. Creation of view does not require resource authorization.A user who creates a vie w does not necessarily receive all priviliges on that view.He receives only those privileges that provide no additional authorization beyond those he already had.Department of Information Technology/GUI & DBM(Sem: III) Page 20
  • K. J. Somaiya Institute of Engineering & Information Technology Conclusion: A view is a critcal table which gives access to a subset of columnns from one or more tables.Various operations can be performed over views like creating views,modifying data using views,altering views and dropping views.Views are means for security of database. Reference book: Database System and concepts Author: Henry F.Korth,Sliberchartz ,Sudarshan Publication: Tata McGraw Hill Output:Department of Information Technology/GUI & DBM(Sem: III) Page 21
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:- 8Aim : To design layout for forms required in the application and to study various controls in VB.Resources Used : Windows Xp professional, MS world.Theory : In a company database we need to create forms for all the master tables and many tomany relationship related tables.We need to insert, delete and update, search data in these relations. So we need to create a formwhich have labeled controls for various attributes of the relation .Generally to accept input from user textbox is preferred and for predefined values listbox orcombobox is preferredEmployee form:Employee fname: lable and textboxEmployee mname: lable and textboxEmployee lname: label and textboxSSN : textboxCity: textboxSalary : textboxDepartment number: listboxNew : command buttonSave : command buttonDelete : command buttonSearch : command buttonDisplay : command buttonAlong with these we need proper labels to describe these fields so that user will come to know inwhich field which data is to be entered.Department formDepartment name: textboxDepartment number: textboxDepartment location:textboxAlgorithm / Activity Diagram:New : command buttonSave : command buttonDelete : command buttonSearch : command buttonDisplay : command buttonDepartment of Information Technology/GUI & DBM(Sem: III) Page 22
  • K. J. Somaiya Institute of Engineering & Information TechnologyWorks on formSSN: listboxProject number :listboxNumber of hrs: textboxSave : command buttonDelete : command buttonSearch : command buttonDisplay : command buttonProject formProject number: textboxProject name: textboxProject location: textboxDepartment number:listboxNew : command buttonSave : command buttonDelete : command buttonSearch : command buttonDisplay : command buttonA control is an object that can be frawn on a form to enhance user interaction with the application.They respond to events initiated by the user or triggered by the system. Controls in VB aredivided in to 1) intrinsic controls;Control descriptionLabel Displays text on a form(read only text)Frame Serves as a container for other controlsCheckbox Enables users to select or deselect an optionCombobox Allows users to select from a list of items or add a new valueHscrollbar Allows users to scroll horixontally through a list of data in another controlTimer Lets your program perform actions in real time, without user interactionDirlList box Enables users to select a directory or folderShape Displays a shape on a formImage Diaplays graphics on a form but cant be a containerPicturebox Displays graphics on a form and can serve as a containerDepartment of Information Technology/GUI & DBM(Sem: III) Page 23
  • K. J. Somaiya Institute of Engineering & Information TechnologyCommand button Enables users to initiate actionsOption button Lets users select one choice from a group; must be used in groups o f tow or moreList box Enables users to select from a list itemsVscrollbar Enables users to select from a list of itemsDrive list box Lets users select a disk driveLine Displays a line on a formData Lets your program connect to databaseFile list box Lets users select a file 2) Active X controlsControl DescriptionMSFlexGird For displaying contents of relations on formADO Data control Required for database connectivityAll above controls have many properties which can be set by designer to make GUI attractive andeffective.Among these name and caption are two important properties.Name property take the name for control which is used in coding and caption value of control isdisplayed on the form.Conclusion: In this based on the requirements of the application form design is done. Variousfields and operations using the form are decided. Various controls available in visual basic arestudied.Reference book:Visual Basic 6 programming Black BookAuthor:Steven HolznerPublication:DreamtechProgram :How many forms will be there and what all fields will be there in each form is decided andvarious operations to be done are also decided.Output :Rough sketches of the forms.Department of Information Technology/GUI & DBM(Sem: III) Page 24
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:- 9Aim : To implement various forms required for application using VB 6.0 applying GUI designconcepts to it , business logic development and study of various coding constructs forapplications.Resources Used : VB 6.0, Microsoft Windows Xp professional.Theory : A graphical user interface is a type of user interface using graphics for interaction with acomputer or other media formats which employs graphical images, widgets along with text torepresent the information and actions available to a user. Actions are performed through directmanipulation of graphical elements(e.g clicking the command button). We must be very clearabout the colour selections, placement of graphical elements. We should take care that graphicalelements used in interface communicate correct meaning to user.Visual basic is a true graphical development environment. It allows programmers to quicklydevelop powerful Windows applications. It has the ability to develop programs that can be used aa front end application to a database system, serving as the user interface which collects user inputand displays formatted output in a more appealing and useful form. As programmer works in thegraphical environment much of the program code is automatically generated by the Visual basicprogram. Developing applications with VB is three step approach: 1) design the appearance of the application(i.e form design by drag and drop controls in tool box of visual basic editor) 2) assign property settings to the objects of the program 3) write code to direct specific tasks at runtimeWe use Visual Basic 6.0 as event driven programming for developing code for business logic.Actually, while programming in Visual Basic, it must first be decided how the applicationinteracts with the user. In other words, it must be decided how each control reacts to user actions,such as the click of a mouse, keystrokes and so on and these reactions must be programmed. Thisis called Event driven programming because the application does not determine the flow, instead,the events caused by the user determine the flow of the application.Various object in VB are various controls in the form. With every object some predefined eventsare associated. And for every event event handler function is provided in which write code aboutaction to be taken for that event.To effectively control the VB program flow we use various control statements listed below1) If...Then...Else statement is used together with the conditional operators and logical operators.The general format for the if...then...else statement isIf conditions ThenVB expressionsElseVB expressionsEnd IfSimilarly we can use nested else if.Department of Information Technology/GUI & DBM(Sem: III) Page 25
  • K. J. Somaiya Institute of Engineering & Information Technology2) Select case statement is multi way flow control statementThe general format isSelect case textexpressionCase exp1 list of vb statementsCase exp2 list of vb statementsEnd selectWe have various looping statements in visual basic. Most commonly use are1) for ------ next statementGeneral format isFor i=0 to nVb statementsIn body of loopNext i2) while -----wend statementGeneral format isWhile conditionVb statementsIn body of loopwendAlong with all these controls we use most common built in function msgbox()MsgBox() function.The function displays a dialog box with a message and waits for the userto close it by clicking on a button.Conclusion: All forms are designed with required fields and relevant properties of control fieldsare set.Reference book:Visual Basic 6 programming Black BookAuthor:Steven HolznerPublication:DreamtechDepartment of Information Technology/GUI & DBM(Sem: III) Page 26
  • K. J. Somaiya Institute of Engineering & Information TechnologyProgram :Go to start menuSelect programsSelect Microsoft visual studioSelect Microsoft visual basic 6.0Editor will be openedWhich will have tool box on the leftmost sideProperties , project explorer, layout windows on rightmost sideJust drag and drop desire controls from tool box and set properties in properties window(mainlycaption and name properties of every control)Output :e.g employee formSimilarly all other forms can be designedDepartment of Information Technology/GUI & DBM(Sem: III) Page 27
  • K. J. Somaiya Institute of Engineering & Information Technology Experiment No:- 10Aim : To establish the SQL server 2000 and VB 6.0 connectivity through ADO.Resources Used : VB 6.0, Microsoft Windows Xp professional Ms SQL server 2000.Theory :ADO is the object-based interface that provides a logical set of objects that can be accessedfrom code.These objects are:Connection : Establishes the connection with the data base.Property:connectionstring Valuse of these property is string specifying loction of the database.Methods:Open( ) : used to open connection with database(if path is passed as parameter and if connectionstring property is set then all paramerer to open are optional)Close() : used to close connection opened by open methodExecute() : executes query on database and returns recordset object.Command. Defines the commands that will be executed against the database.Recordset. Contains the data that is retrieved from the database.EOF and BOF are only propertyies of recordset object used to check whthere recordset is emptyor not.These objects present an interface in the form of properties and methods that can bequeried and manipulated. ADO was specifically developed to be small, lightweight, fast andfeaturecomplete . for the database applications or for the Internet.An important thing in ADO is that the objects in this model are not dependant on oneanother. This means that one can create instances of objects independent of one another, forexample, one can create a Recordset object without creating a connection object.Unlike the older technologies, ADO is more flexible, ADO code is easier to write, read andmaintain. ADO is built on top of OLE DB and is capable of accessing any sort of data that iswrappedand exposed by an appropriate OLE DB provider.Department of Information Technology/GUI & DBM(Sem: III) Page 28
  • K. J. Somaiya Institute of Engineering & Information TechnologyConclusion: There are many techniques for connecting database with front end. In thisexperiment SQL server 2000 connectivity using V B 6.0 ADO is studiedReference book:Visual Basic 6 programming Black BookAuthor:Steven HolznerPublication: DreamtechProgram :Create system DSNGo to control panal administrative tools ODBC data sources select system dsn tab clickadd Select driver (SQL server) finish write dsn name and server name - click nextclick next change default database to your database name- click next finish test datasource tested successfully ok ok okDesign GUINow in VB design form and drag and drop ADODC control on it. If control is not available in thetool box then press ctrl + T to display component box and click in text box Microsoft Ado datacontrol 6.0(OLE DB) to add it to tool box.In the properties window of the ADODC control click connectionstring property and build it.For every control that is displaying data retrived from relation set datasource and datafieldproperty correctly.Output :Department of Information Technology/GUI & DBM(Sem: III) Page 29