SlideShare a Scribd company logo
1 of 39
Prof. Prachi Sasankar.
Dept. of Comp.Science
Sadabai Raisoni Women’s College, Nagpur
Introduction
 VB.Net is developed by Microsoft
 It is Visual Basic for .Net Platform
 Ancestor of VB.Net is BASIC
 In 1991, Microsoft added visual components to BASIC
and created Visual Basic
 After the development of .Net, VB was added with more
set of controls and components and thus evolved a new
language VB.Net
Prof. Prachi Sasankar. TY-BCA-Visual Database Programming
Topics
 Introduction to VB .Net
 Creating VB .Net Project in VS 2005
 Data types and Operators in VB .Net
 String Functions
 Conditions (If Else, Select Case)
 Loops (Do While, Do Until, For)
 Classes, Objects
 Sub routines and Functions
 Constructor and Destructor
 Windows Application
 Collections
 File Handling
 Exception Handling
 Data base connectivity
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Pros and Cons
 Pros
 Faster development of programs
 Rich set of controls
 Object Orientation of language enhances
modularity, readability and maintainability
 Cons
 Debugging larger programs is difficult, due to the
absence of an effective debugger
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Features of VB .Net
 Object Oriented Language
 We can drag controls from the tool bar and drop
them on the form and write code for the controls
 Runs on the CLR (Common Language Runtime)
 Release of unused objects taken care by the CLR
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Creating VB .Net Project in VS 2005
 Open Visual Studio 2005
 Click File -> New -> Project
 Choose Language as VB .Net
 Choose Type (Either Console Application or what ever
we want)
 Give the path under which the project need to be saved
 Click OK
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Input and Output
 Under the namespace System there is a class called Console
 Console has 2 methods
 ReadLine() – Reads a line from the user
 WriteLine() – writes as line to the screen
 Name spaces can be included in our code using the keyword
imports
 Eg:
Imports System.Console
 EX:
 Dim I as Integer
I = console.ReadLine() ‘ Gets the value from user and stores it in
variable I
 Console.WriteLine(I) ‘Displays the value of I
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Data types and Operators in VB
.Net
 Data types
 Integer, string, single, double, boolean, char
 Operators
 Arithmetic (+,-,*,/,,Mod)
 Logical (Or, And)
 Relational (=,<>,<,<=,>,>=)
Prof.Prachi Sasankar. TY-
BCA-Visual Database Programming
String Functions
 Len(str) – Length of the string str
 Str.Replace(“old”,”New”) – Replaces Old with New in
the string Str
 Str.Insert(pos,”string”) – Inserts the string specified at
the position pos in the string Str
 Trim(str) – Removes the leading and trailing spaces in
the string str
Prof.Prachi Sasankar. TY-
BCA-Visual Database Programming
If Else
If (Condition)
Then
Statements executed if condition is true
Else
Statements executed if condition is false
EndIf
We can also have Else If block in If Else statements
 If (a=0)
 Then
 Console.Writeline(“Zero”)
 Else If(a<0)
 Then
 Console.Writeline(“Negative”)
 Else
 Console.Writeline(“Positive”)
 EndIf
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Select Case
Select Case var
Case 1
stmt1 // executed if var = 1
Case 2
stmt2 // executed if var = 2
Case Else
stmt3 // executed if var is other than 1 and 2
End Select
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
For Loop
For <<var>> = start To end Step <<val>>
Statements
Next
Eg
For I = 1 To 10 Step 2
Console.WriteLine(I)
Next
Here the values printed will be 1,3,5,7,9
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Do While Loop
1. Do While(a<>0)
Console.Writeline(a)
a = a – 1
Loop
2. Do
Console.Writeline(a)
a = a – 1
Loop While(a<>0)
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Do Until Loop
1. Do Until(a=0)
Console.Writeline(a)
a = a – 1
Loop
2. Do
Console.Writeline(a)
a = a – 1
Loop Until(a=0)
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Class
 Software structure that is important in Object
Oriented Programming
 Has data members and methods
 Blue print or proto type for an object
 Contains the common properties and methods of an
object
 Few examples are Car, Person, Animal
 Class Person
1. Properties: Name, Height, Weight etc
2. Methods: Run, Walk, Speak
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Object
 Instance of a class
 Gives Life to a class
 Ram is an object belonging to the class Person
 Ford is an object belonging to the class Car
 Jimmy is an object belonging to the class Animal
 Public Class Test
 Dim a As Integer
 Sub Print()
 Console.WriteLine(“Hello”)
 End Sub
 Public Function add(ByVal a as Integer, ByVal b as Integer) as Integer
 Return (a+b)
 End Function
 End Class
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Subroutines and Functions
 Subroutines
 Does not return any value
 Can have zero or more parameters
 Functions
 Always Returns some value
 Can have zero or more parameters
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Constructor
 Used for initializing private members of a class
 Name of the constructor should be New() always
 Can have zero or more parameters
 Does not return any value. So they are sub routines
 Need not be invoked explicitly. They are invoked
automatically when an object is created
 A class can have more than one constructor
 Every constructor should differ from the other by
means of number of parameters or data types of
parameters
 Constructors can be inherited
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Destructor
 Used for releasing memory consumed by objects
 Name of the destructor should be Finalize() and the
method is already defined in CLR. So we can only
override it.
 Does not return any value. Hence it is a subroutine
 Does not accept any parameters
 Only one destructor for a class
 Destructors are not inherited
 No need of explicit invocation. They are called when
the execution is about to finish.
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Collections
 Array List
 Sorted List
 Hash Table
 Stack
 Queue
 These can be accessed via the System.Collections
namespace
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Array List
 Array List is a dynamic array
 Its size grows with the addition of element
 Searching is based on the index
 Sequential search is performed on elements
 Hence it is slow
 Occupies less space
 Dim Arr as New ArrayList()
 Arr.Add(1)
 Arr.Add(2)
 The above code adds two elements 1 and 2 to the array list Arr
 To access individual element, Arr.Item(1) – fetches 2
 It is a zero based collection
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Sorted List
 Elements are stored as key value pairs
 They are sorted according to the key
 Search is based on index as well as on keys
 Hence faster than Array List
 Occupies Medium amount of space
 Keys cannot be duplicate or null
 Values can be duplicated and also can be null
 Dim Sl as New SortedList()
 Sl.Add(1,”One”)
 Sl.Add(2,”Two”)
 Sl.Item(1) // fetches 1
 Sl.GetKey(1) //fetches the 1st Key,I.e. 1
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Hash Table
 Hash table stores data as a key value pair
 Here the keys can be duplicated
 Search is based on the hash of key values
 Very fast way of searching elements
 Occupies large space
 Dim ht As New Hashtable()
 ht.Add(1, “Ram”)
 ht.Add(2,”Raj”)
 ht.Item(2) // fetches Raj
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Stack
 Stack is a data structure where elements are retrieved in the
order opposite to which they are added
 It implements LIFO (Last In First Out) algorithm
 Its method called Push() is for adding elements
 Its method Pop() is for removing elements
 Dim stack As New Stack(5)
 Dim i As Integer
 For i = 1 To 5
 stack.Push(i)
 Next
 For i = 1 To stack.Count
 WriteLine(stack.Pop())
 Next
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Queue
 Queue is a data structure where elements are retrieved in
the same order in which they are added
 It implements FIFO (First In First Out) algorithm
 Its method called Enqueue() is for adding elements
 Its method called Dequeue() is for removing the elements
 Dim queue As New Queue(5)
 Dim i As Integer
 For i = 1 To 5
 queue.Enqueue(i)
 Next
 For i = 1 To queue.Count
 WriteLine(queue.Dequeue())
 Next
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Windows Application
 File -> New -> Project
 Select Language as VB .Net
 Select .Net template as Windows Application
 Give the path where the application need to be saved
 A application opens up with a Form
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Forms and other controls
 Form is a container for other controls
 We can place the following in a form
 Label
 Text Box
 Check Box
 Radio Button
 Button
 Date Picker
 And more…
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Properties and Events
 Every Control has a set of properties, methods and events
associated with it
 Eg Form
 Properties
 Name (program will use this name to refer)
 Text (title of the form)
 Methods
 Show
 Hide
 Close
 Events
 Load
 UnLoad
 If we hide a form, it is still in the memory. It can be shown at any time.
 If we close a form, it is erased out of the memory. Same as destroying an
instance of the form. We need to recreate it if needed to see it again.
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Exception Handling
 Exception is Run time error
 It is not known at the compile time
 Examples of exceptions
 Divide by zero
 Accessing non existing portion of memory
 Memory overflow due to looping
 In VB .Net, exception is handled via Try Catch
Mechanism
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Try Catch Finally
Try
Suspicious code that may throw an exception to be written
here
Catch ex As Exception
What to be done if exception occurs to be written here
Finally
Optional portion which will be executed irrespective of the
happening of exception to be written here. Can contain
code for releasing unnecessary space
 Catch block with Specific exception to be given first and then
the generic type Exception
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
File Handling
 In the System Namespace, the IO class has several
subclasses for file handling, text processing etc
 Classes File, Directory are used for creating, deleting
file or folders and also has methods to play with them
 Class FileStream is used for creating and manipulating
files
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Reader and Writer
 BinaryReader
 This class has methods to read binary or raw data
 BinaryWriter
 This class has methods to write binary or raw data
 StreamReader
 This class has methods to read stream of data
 StreamWriter
 This class has methods to write stream of data
 Stream is a channel through which an object (file
in this case) is accessed
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
File Handling
 Open the file using FileStream class. This makes use of
FileMode and FileAccess enumeration to specify how to
open a file (for creating a new file or opening an existing
file) and whether the file is read only or write only or read
write
 Associate a reader for the stream
 Read the file and do the manipulations
 Open a file stream for writing
 Associate a writer
 Write contents to file
 Close the stream, so that it will be released back to the memory pool
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Operations on a file
 Create
 Move
 Copy
 Replace
 Read
 Write
 Delete
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Database Connectivity
 Following are important to get connected to the database
and perform operations
 Connection Object
 Command Object
 Operation on the Command Object
 Using Dataset and Data adapter
 Using Data Reader
 If we use data adapter, it is called as disconnected
architecture
 If we use data reader, it is called as connected architecture
 Connected Architecture – An active connection to the database is
required. Connection need to be opened and closed explicitly
 Disconnected Architecture – Connection management is done internally.
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Connection Object
 Dim con as New OdbcConnection(connectionstring)
 Where connectionstring is a string that contains
details about the server where the database is located,
the name of the database, user id and password
required for getting connected and the driver details
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Command Object
 Dim cmd as New OdbcCommand(strCmd,con)
 strCmd – is the select/insert/update/delete statement or exec
<<storedProc>> command
 Con is the connection object created in the first step
 Properties – cmd.CommandType
 This can be either Text or StoredProcedure
Command Methods
 Cmd.ExecuteReader() – Returns one or more table row(s) –
for select statement
 Cmd.ExecuteScalar() – Returns a single value – for select
statement with aggregate function
 Cmd.ExecuteNonQuery() – Used for executing stored
procedure or insert/update/delete statements
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Data Reader and Data Set
 Data Reader
 Dim dr as OdbcDataReader
 This dr holds the result set present in datareader object
 Data Set
 Dim ds as New DataSet()
 ds holds the result of select statement
 Data adapter is used to fill the data set
Data Adapter
 Data adapter fills in the data set with the result of the select query
 Dim da as New OdbcDataAdapter(cmd)
 Cmd is the command object created
 da.Fill(ds) fills the dataset
 The data set can be set as a data source for various controls in the
web form or windows form
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
Connectivity:
 For MS SQL server we have corresponding Connection, Command, datareader and data adapter object
 They are:
 SqlDataReader
 SqlDataAdapter
 SqlConnection
 SqlCommand
 For My SQL we have corresponding Connection, Command, datareader and data adapter object
 They are:
 OdbcDataReader
 OdbcDataAdapter
 OdbcConnection
 OdbcCommand
 For Oracle server we have corresponding Connection, Command, datareader and data adapter object
 They are:
 OracleDataReader
 OracleDataAdapter
 OracleConnection
 OracleCommand
 For MS Access/ Excel we have corresponding Connection, Command, datareader and data adapter object
 They are:
 OledbDataReader
 OledbDataAdapter
 OledbConnection
 OledbCommand
Prof.Prachi Sasankar. TY-BCA-Visual Database Programming

More Related Content

What's hot

Visual basic
Visual basicVisual basic
Visual basicDharmik
 
Book management system
Book management systemBook management system
Book management systemSHARDA SHARAN
 
visualbasicprograming
visualbasicprogramingvisualbasicprograming
visualbasicprogramingdhi her
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phaseSuyash Srivastava
 
Chapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 ProgrammingChapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 Programmingpatf719
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture AqsaHayat3
 
Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesAdan Hubahib
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programmingRoger Argarin
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingAbha Damani
 

What's hot (20)

Visual basic
Visual basicVisual basic
Visual basic
 
Compiler design
Compiler designCompiler design
Compiler design
 
Introduction to Java Applications
Introduction to Java ApplicationsIntroduction to Java Applications
Introduction to Java Applications
 
Book management system
Book management systemBook management system
Book management system
 
visualbasicprograming
visualbasicprogramingvisualbasicprograming
visualbasicprograming
 
phases of compiler-analysis phase
phases of compiler-analysis phasephases of compiler-analysis phase
phases of compiler-analysis phase
 
Visual programming
Visual programmingVisual programming
Visual programming
 
Chapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 ProgrammingChapter 01: Intro to VB2010 Programming
Chapter 01: Intro to VB2010 Programming
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Introduction to programming languages part 2
Introduction to programming languages   part 2Introduction to programming languages   part 2
Introduction to programming languages part 2
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 
Compiler lecture 03
Compiler lecture 03Compiler lecture 03
Compiler lecture 03
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
 
Visual basic
Visual basicVisual basic
Visual basic
 
phases of a compiler
 phases of a compiler phases of a compiler
phases of a compiler
 
Chapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming LanguagesChapter 1 - An Overview of Computers and Programming Languages
Chapter 1 - An Overview of Computers and Programming Languages
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 
Unit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programmingUnit 1 introduction to visual basic programming
Unit 1 introduction to visual basic programming
 
Visual programming
Visual programmingVisual programming
Visual programming
 
As pnet
As pnetAs pnet
As pnet
 

Similar to Ty bca-sem-v-introduction to vb.net-i-uploaded

Cs6301 programming and datastactures
Cs6301 programming and datastacturesCs6301 programming and datastactures
Cs6301 programming and datastacturesK.s. Ramesh
 
Introduction to apex
Introduction to apexIntroduction to apex
Introduction to apexRinku Saini
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import JavaMelody Rios
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdfhamzadamani7
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersDave Bost
 
Introduction to DataFusion An Embeddable Query Engine Written in Rust
Introduction to DataFusion  An Embeddable Query Engine Written in RustIntroduction to DataFusion  An Embeddable Query Engine Written in Rust
Introduction to DataFusion An Embeddable Query Engine Written in RustAndrew Lamb
 
Advanced full text searching techniques using Lucene
Advanced full text searching techniques using LuceneAdvanced full text searching techniques using Lucene
Advanced full text searching techniques using LuceneAsad Abbas
 
Get started with R lang
Get started with R langGet started with R lang
Get started with R langsenthil0809
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packagesAjay Ohri
 
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]Rome468
 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource GroupLINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource GroupShahzad
 
Introduction to Apache Flink
Introduction to Apache FlinkIntroduction to Apache Flink
Introduction to Apache Flinkmxmxm
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010Satish Verma
 
05 entity framework
05 entity framework05 entity framework
05 entity frameworkglubox
 

Similar to Ty bca-sem-v-introduction to vb.net-i-uploaded (20)

Cs6301 programming and datastactures
Cs6301 programming and datastacturesCs6301 programming and datastactures
Cs6301 programming and datastactures
 
Introduction to apex
Introduction to apexIntroduction to apex
Introduction to apex
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import Java
 
540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf540slidesofnodejsbackendhopeitworkforu.pdf
540slidesofnodejsbackendhopeitworkforu.pdf
 
Database programming
Database programmingDatabase programming
Database programming
 
Java scriptforjavadev part2a
Java scriptforjavadev part2aJava scriptforjavadev part2a
Java scriptforjavadev part2a
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
Introduction to DataFusion An Embeddable Query Engine Written in Rust
Introduction to DataFusion  An Embeddable Query Engine Written in RustIntroduction to DataFusion  An Embeddable Query Engine Written in Rust
Introduction to DataFusion An Embeddable Query Engine Written in Rust
 
Advanced full text searching techniques using Lucene
Advanced full text searching techniques using LuceneAdvanced full text searching techniques using Lucene
Advanced full text searching techniques using Lucene
 
Get started with R lang
Get started with R langGet started with R lang
Get started with R lang
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packages
 
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]
 
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource GroupLINQ 2 SQL Presentation To Palmchip  And Trg, Technology Resource Group
LINQ 2 SQL Presentation To Palmchip And Trg, Technology Resource Group
 
Matlab OOP
Matlab OOPMatlab OOP
Matlab OOP
 
Introduction to Apache Flink
Introduction to Apache FlinkIntroduction to Apache Flink
Introduction to Apache Flink
 
Salesforce
SalesforceSalesforce
Salesforce
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
05 entity framework
05 entity framework05 entity framework
05 entity framework
 
I explore
I exploreI explore
I explore
 

More from Prachi Sasankar

St all about test case-p3
St all about test case-p3St all about test case-p3
St all about test case-p3Prachi Sasankar
 
Importance of E- commerce
Importance of E- commerceImportance of E- commerce
Importance of E- commercePrachi Sasankar
 
Wireless application protocol
Wireless application protocolWireless application protocol
Wireless application protocolPrachi Sasankar
 
Ecomm-History and Overview
Ecomm-History and OverviewEcomm-History and Overview
Ecomm-History and OverviewPrachi Sasankar
 
VB.Net-Controls and events
VB.Net-Controls and eventsVB.Net-Controls and events
VB.Net-Controls and eventsPrachi Sasankar
 
Unix shell programming intro-part-1
Unix shell programming intro-part-1Unix shell programming intro-part-1
Unix shell programming intro-part-1Prachi Sasankar
 
Ide and datatypes vb-net-u-ii-p2
Ide and datatypes  vb-net-u-ii-p2Ide and datatypes  vb-net-u-ii-p2
Ide and datatypes vb-net-u-ii-p2Prachi Sasankar
 
ST-All about Test Case-p3
ST-All about Test Case-p3ST-All about Test Case-p3
ST-All about Test Case-p3Prachi Sasankar
 
Types of software testing
Types of software testingTypes of software testing
Types of software testingPrachi Sasankar
 
I ntroduction to software testing part1
I ntroduction to software testing part1I ntroduction to software testing part1
I ntroduction to software testing part1Prachi Sasankar
 
Software Engineering Overview
Software Engineering OverviewSoftware Engineering Overview
Software Engineering OverviewPrachi Sasankar
 

More from Prachi Sasankar (13)

Software metrics
Software metricsSoftware metrics
Software metrics
 
St all about test case-p3
St all about test case-p3St all about test case-p3
St all about test case-p3
 
Importance of E- commerce
Importance of E- commerceImportance of E- commerce
Importance of E- commerce
 
Wireless application protocol
Wireless application protocolWireless application protocol
Wireless application protocol
 
Ecomm-History and Overview
Ecomm-History and OverviewEcomm-History and Overview
Ecomm-History and Overview
 
E-Comm-overview
E-Comm-overviewE-Comm-overview
E-Comm-overview
 
VB.Net-Controls and events
VB.Net-Controls and eventsVB.Net-Controls and events
VB.Net-Controls and events
 
Unix shell programming intro-part-1
Unix shell programming intro-part-1Unix shell programming intro-part-1
Unix shell programming intro-part-1
 
Ide and datatypes vb-net-u-ii-p2
Ide and datatypes  vb-net-u-ii-p2Ide and datatypes  vb-net-u-ii-p2
Ide and datatypes vb-net-u-ii-p2
 
ST-All about Test Case-p3
ST-All about Test Case-p3ST-All about Test Case-p3
ST-All about Test Case-p3
 
Types of software testing
Types of software testingTypes of software testing
Types of software testing
 
I ntroduction to software testing part1
I ntroduction to software testing part1I ntroduction to software testing part1
I ntroduction to software testing part1
 
Software Engineering Overview
Software Engineering OverviewSoftware Engineering Overview
Software Engineering Overview
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 

Ty bca-sem-v-introduction to vb.net-i-uploaded

  • 1. Prof. Prachi Sasankar. Dept. of Comp.Science Sadabai Raisoni Women’s College, Nagpur
  • 2. Introduction  VB.Net is developed by Microsoft  It is Visual Basic for .Net Platform  Ancestor of VB.Net is BASIC  In 1991, Microsoft added visual components to BASIC and created Visual Basic  After the development of .Net, VB was added with more set of controls and components and thus evolved a new language VB.Net Prof. Prachi Sasankar. TY-BCA-Visual Database Programming
  • 3. Topics  Introduction to VB .Net  Creating VB .Net Project in VS 2005  Data types and Operators in VB .Net  String Functions  Conditions (If Else, Select Case)  Loops (Do While, Do Until, For)  Classes, Objects  Sub routines and Functions  Constructor and Destructor  Windows Application  Collections  File Handling  Exception Handling  Data base connectivity Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 4. Pros and Cons  Pros  Faster development of programs  Rich set of controls  Object Orientation of language enhances modularity, readability and maintainability  Cons  Debugging larger programs is difficult, due to the absence of an effective debugger Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 5. Features of VB .Net  Object Oriented Language  We can drag controls from the tool bar and drop them on the form and write code for the controls  Runs on the CLR (Common Language Runtime)  Release of unused objects taken care by the CLR Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 6. Creating VB .Net Project in VS 2005  Open Visual Studio 2005  Click File -> New -> Project  Choose Language as VB .Net  Choose Type (Either Console Application or what ever we want)  Give the path under which the project need to be saved  Click OK Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 7. Input and Output  Under the namespace System there is a class called Console  Console has 2 methods  ReadLine() – Reads a line from the user  WriteLine() – writes as line to the screen  Name spaces can be included in our code using the keyword imports  Eg: Imports System.Console  EX:  Dim I as Integer I = console.ReadLine() ‘ Gets the value from user and stores it in variable I  Console.WriteLine(I) ‘Displays the value of I Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 8. Data types and Operators in VB .Net  Data types  Integer, string, single, double, boolean, char  Operators  Arithmetic (+,-,*,/,,Mod)  Logical (Or, And)  Relational (=,<>,<,<=,>,>=) Prof.Prachi Sasankar. TY- BCA-Visual Database Programming
  • 9. String Functions  Len(str) – Length of the string str  Str.Replace(“old”,”New”) – Replaces Old with New in the string Str  Str.Insert(pos,”string”) – Inserts the string specified at the position pos in the string Str  Trim(str) – Removes the leading and trailing spaces in the string str Prof.Prachi Sasankar. TY- BCA-Visual Database Programming
  • 10. If Else If (Condition) Then Statements executed if condition is true Else Statements executed if condition is false EndIf We can also have Else If block in If Else statements  If (a=0)  Then  Console.Writeline(“Zero”)  Else If(a<0)  Then  Console.Writeline(“Negative”)  Else  Console.Writeline(“Positive”)  EndIf Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 11. Select Case Select Case var Case 1 stmt1 // executed if var = 1 Case 2 stmt2 // executed if var = 2 Case Else stmt3 // executed if var is other than 1 and 2 End Select Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 12. For Loop For <<var>> = start To end Step <<val>> Statements Next Eg For I = 1 To 10 Step 2 Console.WriteLine(I) Next Here the values printed will be 1,3,5,7,9 Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 13. Do While Loop 1. Do While(a<>0) Console.Writeline(a) a = a – 1 Loop 2. Do Console.Writeline(a) a = a – 1 Loop While(a<>0) Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 14. Do Until Loop 1. Do Until(a=0) Console.Writeline(a) a = a – 1 Loop 2. Do Console.Writeline(a) a = a – 1 Loop Until(a=0) Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 15. Class  Software structure that is important in Object Oriented Programming  Has data members and methods  Blue print or proto type for an object  Contains the common properties and methods of an object  Few examples are Car, Person, Animal  Class Person 1. Properties: Name, Height, Weight etc 2. Methods: Run, Walk, Speak Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 16. Object  Instance of a class  Gives Life to a class  Ram is an object belonging to the class Person  Ford is an object belonging to the class Car  Jimmy is an object belonging to the class Animal  Public Class Test  Dim a As Integer  Sub Print()  Console.WriteLine(“Hello”)  End Sub  Public Function add(ByVal a as Integer, ByVal b as Integer) as Integer  Return (a+b)  End Function  End Class Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 17. Subroutines and Functions  Subroutines  Does not return any value  Can have zero or more parameters  Functions  Always Returns some value  Can have zero or more parameters Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 18. Constructor  Used for initializing private members of a class  Name of the constructor should be New() always  Can have zero or more parameters  Does not return any value. So they are sub routines  Need not be invoked explicitly. They are invoked automatically when an object is created  A class can have more than one constructor  Every constructor should differ from the other by means of number of parameters or data types of parameters  Constructors can be inherited Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 19. Destructor  Used for releasing memory consumed by objects  Name of the destructor should be Finalize() and the method is already defined in CLR. So we can only override it.  Does not return any value. Hence it is a subroutine  Does not accept any parameters  Only one destructor for a class  Destructors are not inherited  No need of explicit invocation. They are called when the execution is about to finish. Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 20. Collections  Array List  Sorted List  Hash Table  Stack  Queue  These can be accessed via the System.Collections namespace Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 21. Array List  Array List is a dynamic array  Its size grows with the addition of element  Searching is based on the index  Sequential search is performed on elements  Hence it is slow  Occupies less space  Dim Arr as New ArrayList()  Arr.Add(1)  Arr.Add(2)  The above code adds two elements 1 and 2 to the array list Arr  To access individual element, Arr.Item(1) – fetches 2  It is a zero based collection Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 22. Sorted List  Elements are stored as key value pairs  They are sorted according to the key  Search is based on index as well as on keys  Hence faster than Array List  Occupies Medium amount of space  Keys cannot be duplicate or null  Values can be duplicated and also can be null  Dim Sl as New SortedList()  Sl.Add(1,”One”)  Sl.Add(2,”Two”)  Sl.Item(1) // fetches 1  Sl.GetKey(1) //fetches the 1st Key,I.e. 1 Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 23. Hash Table  Hash table stores data as a key value pair  Here the keys can be duplicated  Search is based on the hash of key values  Very fast way of searching elements  Occupies large space  Dim ht As New Hashtable()  ht.Add(1, “Ram”)  ht.Add(2,”Raj”)  ht.Item(2) // fetches Raj Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 24. Stack  Stack is a data structure where elements are retrieved in the order opposite to which they are added  It implements LIFO (Last In First Out) algorithm  Its method called Push() is for adding elements  Its method Pop() is for removing elements  Dim stack As New Stack(5)  Dim i As Integer  For i = 1 To 5  stack.Push(i)  Next  For i = 1 To stack.Count  WriteLine(stack.Pop())  Next Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 25. Queue  Queue is a data structure where elements are retrieved in the same order in which they are added  It implements FIFO (First In First Out) algorithm  Its method called Enqueue() is for adding elements  Its method called Dequeue() is for removing the elements  Dim queue As New Queue(5)  Dim i As Integer  For i = 1 To 5  queue.Enqueue(i)  Next  For i = 1 To queue.Count  WriteLine(queue.Dequeue())  Next Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 26. Windows Application  File -> New -> Project  Select Language as VB .Net  Select .Net template as Windows Application  Give the path where the application need to be saved  A application opens up with a Form Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 27. Forms and other controls  Form is a container for other controls  We can place the following in a form  Label  Text Box  Check Box  Radio Button  Button  Date Picker  And more… Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 28. Properties and Events  Every Control has a set of properties, methods and events associated with it  Eg Form  Properties  Name (program will use this name to refer)  Text (title of the form)  Methods  Show  Hide  Close  Events  Load  UnLoad  If we hide a form, it is still in the memory. It can be shown at any time.  If we close a form, it is erased out of the memory. Same as destroying an instance of the form. We need to recreate it if needed to see it again. Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 29. Exception Handling  Exception is Run time error  It is not known at the compile time  Examples of exceptions  Divide by zero  Accessing non existing portion of memory  Memory overflow due to looping  In VB .Net, exception is handled via Try Catch Mechanism Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 30. Try Catch Finally Try Suspicious code that may throw an exception to be written here Catch ex As Exception What to be done if exception occurs to be written here Finally Optional portion which will be executed irrespective of the happening of exception to be written here. Can contain code for releasing unnecessary space  Catch block with Specific exception to be given first and then the generic type Exception Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 31. File Handling  In the System Namespace, the IO class has several subclasses for file handling, text processing etc  Classes File, Directory are used for creating, deleting file or folders and also has methods to play with them  Class FileStream is used for creating and manipulating files Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 32. Reader and Writer  BinaryReader  This class has methods to read binary or raw data  BinaryWriter  This class has methods to write binary or raw data  StreamReader  This class has methods to read stream of data  StreamWriter  This class has methods to write stream of data  Stream is a channel through which an object (file in this case) is accessed Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 33. File Handling  Open the file using FileStream class. This makes use of FileMode and FileAccess enumeration to specify how to open a file (for creating a new file or opening an existing file) and whether the file is read only or write only or read write  Associate a reader for the stream  Read the file and do the manipulations  Open a file stream for writing  Associate a writer  Write contents to file  Close the stream, so that it will be released back to the memory pool Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 34. Operations on a file  Create  Move  Copy  Replace  Read  Write  Delete Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 35. Database Connectivity  Following are important to get connected to the database and perform operations  Connection Object  Command Object  Operation on the Command Object  Using Dataset and Data adapter  Using Data Reader  If we use data adapter, it is called as disconnected architecture  If we use data reader, it is called as connected architecture  Connected Architecture – An active connection to the database is required. Connection need to be opened and closed explicitly  Disconnected Architecture – Connection management is done internally. Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 36. Connection Object  Dim con as New OdbcConnection(connectionstring)  Where connectionstring is a string that contains details about the server where the database is located, the name of the database, user id and password required for getting connected and the driver details Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 37. Command Object  Dim cmd as New OdbcCommand(strCmd,con)  strCmd – is the select/insert/update/delete statement or exec <<storedProc>> command  Con is the connection object created in the first step  Properties – cmd.CommandType  This can be either Text or StoredProcedure Command Methods  Cmd.ExecuteReader() – Returns one or more table row(s) – for select statement  Cmd.ExecuteScalar() – Returns a single value – for select statement with aggregate function  Cmd.ExecuteNonQuery() – Used for executing stored procedure or insert/update/delete statements Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 38. Data Reader and Data Set  Data Reader  Dim dr as OdbcDataReader  This dr holds the result set present in datareader object  Data Set  Dim ds as New DataSet()  ds holds the result of select statement  Data adapter is used to fill the data set Data Adapter  Data adapter fills in the data set with the result of the select query  Dim da as New OdbcDataAdapter(cmd)  Cmd is the command object created  da.Fill(ds) fills the dataset  The data set can be set as a data source for various controls in the web form or windows form Prof.Prachi Sasankar. TY-BCA-Visual Database Programming
  • 39. Connectivity:  For MS SQL server we have corresponding Connection, Command, datareader and data adapter object  They are:  SqlDataReader  SqlDataAdapter  SqlConnection  SqlCommand  For My SQL we have corresponding Connection, Command, datareader and data adapter object  They are:  OdbcDataReader  OdbcDataAdapter  OdbcConnection  OdbcCommand  For Oracle server we have corresponding Connection, Command, datareader and data adapter object  They are:  OracleDataReader  OracleDataAdapter  OracleConnection  OracleCommand  For MS Access/ Excel we have corresponding Connection, Command, datareader and data adapter object  They are:  OledbDataReader  OledbDataAdapter  OledbConnection  OledbCommand Prof.Prachi Sasankar. TY-BCA-Visual Database Programming

Editor's Notes

  1. VB .net is having the latest version 3.0. Gelled with ASP.net.
  2. Comes with Intellisense. Debugging is allowed of single program at a time.