Practical - IV Web Programming Lab
Practical - IV Web Programming Lab
(PRIDE)
PERIYAR UNIVERSITY
SALEM - 636 011.
1
Prepared by :
Dr. I. LAURENCE AROQUIARAJ
Assistant Professor
Department of Computer Science
Periyar University
Periyar Palkalai Nagar
Salem – 636 011.
2
[Link]. COMPUTER SCIENCE
SECOND YEAR
PRACTICAL - IV : WEB PROGRAMMING LAB
3
[Link]
[Link]
Creating and using Variables Arrays and Structures
AIM:-
To write a program for Creating and using Variables, Arrays and
Structures in [Link]
PROCEDURE:-
STEP1 : Start the Project
STEP2 : Open Microsoft Visual Studio 2010 ->File ->New -> Windows
Application and click ok .
STEP3 : Open form1 and place the Textbox and Buttons Control for the
click Events.
STEP4 : Write the code in Form1 inside the controls
STEP5 : Save the Application
STEP6 : Run the Application
STEP7 : Stop the Project.
Source Code:-
Dim I As Integer
Dim emp(25) As employee
Structure employee
Dim rn As Integer
Dim name As String
Dim sal As Decimal
Dim add As String
Dim mbl As Long
End Structure
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
Dim j As Integer
Dim ds As New DataSet("Mydb")
Dim dtbl As New DataTable("Team Data")
[Link]("Rno", GetType(Integer))
[Link]("Name", GetType(String))
[Link]("Salary", GetType(Decimal))
4
[Link]("Address", GetType(String))
[Link]("MobileNo", GetType(Long))
[Link](dtbl)
For j = 0 To I
Dim dr As DataRow = [Link]()
dr(0) = emp(j).rn
dr(1) = emp(j).name
dr(2) = emp(j).sal
dr(3) = emp(j).add
dr(4) = emp(j).mbl
[Link](dr)
Next
[Link] = [Link]("Team Data").DefaultView
End Sub
Private Sub Button2_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
emp(I).rn = [Link]
emp(I).name = [Link]
emp(I).sal = [Link]
emp(I).add = [Link]
emp(I).mbl = [Link]
I += 1
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
MsgBox("Successfully Added The Records....")
End Sub
5
Output:-
Result:-
Thus the above creating and using variables arrays and structures
Program has been executed successfully.
6
[Link]
Creating and using Procedures
AIM:-
To write a program for Creating and using Procedures in [Link]
PROCEDURE:-
STEP1 : Start the Project
STEP2 : Open Microsoft Visual Studio 2010 ->File ->New -> Windows
Application and click ok.
STEP3 : Open form1 and place the Textbox and Buttons Control for the
click Events.
STEP4 : Write the code in the procedure
STEP5 : Save the Application
STEP6 : Run the Application
STEP7 : Stop the Project.
Source Code:-
Public Class Form1
Dim num As Double
Dim num1 As Double
Dim mem As Double
Dim op As Integer
Dim res As Double
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 1
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 2
End Sub
Private Sub Button3_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 3
End Sub
7
Private Sub Button4_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 4
End Sub
Private Sub Button5_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 5
End Sub
Private Sub Button6_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 6
End Sub
Private Sub Button7_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 7
End Sub
Private Sub Button8_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 8
End Sub
Private Sub Button9_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 9
End Sub
Private Sub Button16_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & 0
End Sub
Private Sub Button10_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
num = Val([Link])
[Link] = ""
op = 1
End Sub
8
Private Sub Button11_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
num = Val([Link])
[Link] = ""
op = 2
End Sub
Private Sub Button12_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
num = Val([Link])
[Link] = ""
op = 3
End Sub
Private Sub Button13_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
num = Val([Link])
[Link] = ""
op = 4
End Sub
Private Sub Button14_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link] & "."
End Sub
Private Sub Button15_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
num1 = Val([Link])
Select Case op
Case 1
res = num + num1
Case 2
res = num - num1
Case 3
res = num * num1
Case 4
res = num / num1
End Select
9
[Link] = res
End Sub
Private Sub Button17_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
mem = 0
End Sub
Private Sub Button18_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
mem = mem + Val([Link])
End Sub
Private Sub Button19_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = mem
[Link] = ""
End Sub
Private Sub Button20_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = ""
End Sub
End Class
Output:-
Result:-
Thus the above creating and using Procedures Program has been
Executed successfully.
10
[Link]
Decision Structure
AIM:-
To write a program for Decision Structures in [Link]
PROCEDURE:-
STEP1 : Start the Project
STEP2 : Open Microsoft Visual Studio 2010 ->File ->New -> Windows
Application and click ok.
STEP3 : Open form1 and place the Radio Buttons, Label Control for the
click Events.
STEP4 : Write the code in Form1 inside the controls
STEP5 : Save the Application
STEP6 : Run the Application
STEP7 : Stop the Project.
Source Code:-
Public Class Form1
Dim nxt As Integer
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = "300"
nxt = 0
[Link] = True
[Link] = "Q1. The Brain of any System is?"
[Link] = "CPU"
[Link] = "ALU"
[Link] = "Memory"
End Sub
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
Select Case nxt
Case 0
If [Link] = True Then
[Link] = Val([Link]) + 10
Else
11
[Link]("Wrong Answer")
End If
Case 1
If [Link] = True Then
[Link] = Val([Link]) + 10
Else
[Link]("Wrong Answer")
End If
Case 2
If [Link] = True Then
[Link] = Val([Link]) + 10
Else
[Link]("Wrong Answer")
End If
Case 3
If [Link] = True Then
[Link] = Val([Link]) + 10
Else
[Link]("Wrong Answer")
End If
Case 4
If [Link] = True Then
[Link] = Val([Link]) + 10
Else
[Link]("Wrong Answer")
End If
End Select
End Sub
Private Sub Button2_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = False
[Link] = False
[Link] = False
nxt = nxt + 1
12
Select Case nxt
Case 1
[Link] = "Q2. Which of the following Language used in AI"
[Link] = "FORTRAN"
[Link] = "PROLOG"
[Link] = "COBOL"
Case 2
[Link] = "[Link] is Platform"
[Link] = "Dependent"
[Link] = "Exdependent"
[Link] = "Independent"
Case 3
[Link] = "[Link] of the Following is a Presentation
Program?"
[Link] = "MS-Word"
[Link] = "MS-Excel"
[Link] = "MS-PowerPoint"
Case 4
[Link] = "Q5. WWW stands for"
[Link] = "World Worm Web"
[Link] = "World Wide Web"
[Link] = "World Word Web"
End Select
End Sub
Private Sub Button3_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
End Sub
Private Sub Timer1_Tick(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
If [Link] > 0 Then
[Link] = Val([Link]) - 1
Else
[Link] = 0
13
[Link]()
MsgBox("Sorry Time Up")
MsgBox("Your Score is:" & [Link])
End If
End Sub
End Class
Output:-
Result:-
Thus the above Decision Structures Program has been executed
Successfully.
14
[Link]
Exception Handling
AIM:-
To write a program Exception Handling in [Link]
PROCEDURE:-
STEP1 : Start the Project
STEP2 : Open Microsoft Visual Studio 2010 ->File ->New -> Windows
Application and click ok .
STEP3 : Open form1 and place the Textbox and Buttons Control for the
click Events.
STEP4 : Write the code in Form1
STEP5 : Save the Application using in Exception Handling
STEP6 : Run the Application
STEP7 : Stop the Project.
Source Code:-
Public Class Form1
Dim a, b, c As Integer
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
a = [Link]
b = [Link]
Try
c=a+b
[Link] = c
Catch ex As Exception
[Link]([Link])
End Try
End Sub
Private Sub Button2_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
a = [Link]
b = [Link]
Try
[Link] = c
15
Catch ex As Exception
[Link]([Link])
End Try
End Sub
Private Sub Button3_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
a = [Link]
b = [Link]
Try
c=a*b
[Link] = c
Catch ex As Exception
[Link]([Link])
End Try
End Sub
Private Sub Button4_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
a = [Link]
b = [Link]
Try
c=a/b
[Link] = c
Catch ex As Exception
[Link]([Link])
End Try
End Sub
Private Sub Button5_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
End Class
16
Output:-
Result:-
Thus the above Exception Handling Program has been executed
successfully.
17
[Link]
Menu Editor
AIM:-
To write a program for Menu Editor in [Link]
PROCEDURE:-
STEP1 : Start the Project
STEP2 : Open Microsoft Visual Studio 2010 ->File ->New -> Windows
Application and click ok
STEP3 : Open form1 and place the Text area and Menu Strip for menu
Access
STEP4 : Adding Main menu and sub menus
STEP5 : Double click the form and write code
STEP6 : Save the Application and Run the Application
STEP7 : Stop the Project.
Source Code:-
Public Class Form1
Dim k(500), d As String
Dim i As Integer
Dim c As Integer = 1
Private Sub Timer1_Tick(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = [Link]
End Sub
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = False
[Link]()
End Sub
Private Sub NewToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link] = True
[Link] = ""
[Link]()
End Sub
18
Private Sub CutToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
If [Link] <> "" Then
[Link]()
Else
MsgBox("Select the string")
End If
End Sub
Private Sub CopyToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
If [Link] <> "" Then
[Link]()
Else
MsgBox("Select the string")
End If
End Sub
Private Sub PasteToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link]()
End Sub
Private Sub DeleteToolStripMenuItem1_Click(ByVal sender As
[Link], ByVal e As [Link]) Handles
[Link]
If [Link] <> "" Then
[Link] = ""
Else
MsgBox("Select the string")
End If
End Sub
Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As
[Link], ByVal e As [Link]) Handles
[Link]
[Link]()
End Sub
19
Private Sub ToolStripLabel2_Click(ByVal sender As [Link], ByVal e
As [Link])
If [Link] <> "" Then
[Link]()
Else
MsgBox("Select the string")
End If
End Sub
Private Sub FontToolStripMenuItem2_Click(ByVal sender As
[Link], ByVal e As [Link])
Dim f As New FontDialog
[Link]()
For Each aaa As Control In [Link]
[Link] = [Link]
Next
End Sub
Private Sub BackColorToolStripMenuItem_Click(ByVal sender As
[Link], ByVal e As [Link]) Handles
[Link]
If ([Link]() = [Link]) Then
[Link] = [Link]
End If
End Sub
Private Sub ForeColorToolStripMenuItem1_Click(ByVal sender As
[Link], ByVal e As [Link]) Handles
[Link]
If ([Link]() = [Link]) Then
[Link] = [Link]
End If
End Sub
Private Sub OpenToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link] = "All Files|*.*|Text Files|*.txt;*.c;*.cpp;*.cs;*.java"
If ([Link]() = [Link]) Then
[Link]()
20
[Link]([Link],
[Link])
End If
End Sub
Private Sub ListBox2_SelectedIndexChanged(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link] = New Font([Link], [Link])
End Sub
Private Sub RichTextBox1_KeyPress(ByVal sender As Object, ByVal e As
[Link]) Handles
[Link]
[Link] = "STRING LENGTH: " +
[Link]()
k(i) = [Link]
If [Link] = Chr(8) And i > 0 Then
i=i-1
If k(i - 2).ToString = Chr(32) Then
c -= 1
d = Chr(32)
End If
Else
'MsgBox(Asc([Link]))
For Each b As String In [Link]
i += 1
If d = Chr(32) And b >= Chr(65) And b <= Chr(91) Then
c += 1
21
Private Sub SaveToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link] = "All Files|*.*"
If ([Link]() = [Link]) Then
[Link]([Link],
[Link])
End If
End Sub
Private Sub RedoToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link]()
End Sub
Private Sub RedoToolStripMenuItem1_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link]()
End Sub
Private Sub BoldToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
If [Link] <> "" Then
[Link] = New Font([Link],
[Link])
[Link]()
End If
End Sub
Private Sub ItalicToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
If [Link] <> "" Then
[Link] = New Font([Link],
[Link])
[Link]()
End If
End Sub
Private Sub UnderlineToolStripMenuItem_Click(ByVal sender As
[Link], ByVal e As [Link]) Handles
[Link]
22
If [Link] <> "" Then
[Link] = New Font([Link],
[Link])
[Link]()
End If
End Sub
Private Sub RegularToolStripMenuItem_Click(ByVal sender As
[Link], ByVal e As [Link]) Handles
[Link]
If [Link] <> "" Then
[Link] = New Font([Link],
[Link])
[Link]()
End If
End Sub
23
Private Sub CenterToolStripMenuItem_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link] = [Link]
End Sub
24
End If
End Sub
Private Sub ToolOpen_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = "All Files|*.*|Text Files|*.txt;*.c;*.cpp;*.cs;*.java"
If ([Link]() = [Link]) Then
[Link]()
[Link]([Link],
[Link])
End If
End Sub
Private Sub Toolclose_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
End
End Sub
Private Sub ToolBold_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
If [Link] <> "" Then
[Link] = New Font([Link],
[Link])
[Link]()
End If
End Sub
Private Sub ToolItalic_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
If [Link] <> "" Then
[Link] = New Font([Link],
[Link])
[Link]()
End If
End Sub
Private Sub ToolU_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
If [Link] <> "" Then
25
[Link] = New Font([Link],
[Link])
[Link]()
End If
End Sub
Private Sub Toolundo_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
End Sub
Private Sub ToolRedo_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link]()
End Sub
Private Sub CloseToolStripMenuItem1_Click(ByVal sender As [Link],
ByVal e As [Link]) Handles [Link]
[Link] = False
End Sub
Private Sub InsImage_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = "All files |*.*"
[Link] = True
Dim orgdata = [Link]
If [Link] = [Link] Then
For Each fname As String In [Link]
Dim img As Image = [Link](fname)
[Link](img)
[Link]()
Next
End If
[Link](orgdata)
End Sub
End Class
26
Output:-
Result:-
Thus the above Menu Editor Program has been executed successfully.
27
[Link]
Create and Open Database Using [Link]
AIM:-
To write a program for Create and Open Database Using [Link]
in [Link]
PROCEDURE:-
STEP1 : Start the Project
STEP2 : Open Microsoft Visual Studio 2010 ->File ->New -> Windows
Application and click ok
STEP3 : Open form1 and place the Text Box and labels
STEP4 : The button for insert, delete, update, exit
STEP5 : Create a Database in MS Access
STEP6 : Save the Application and Run the Application
STEP7 : Stop the Project.
Source Code:-
Public Class Form1
Dim con As New [Link]
Dim cmd As New [Link]
Dim d As [Link]
Dim str As String
Dim n, i, a, x As Integer
Dim emp(15) As EMP
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim z As Integer
Try
con = New
[Link]("Provider=[Link].12.0;Data
Source=E:\Programs\MCA\Sem V\.NET\EX6\[Link]")
[Link]()
str = "insert into tbl_ex6 values ('" & [Link] & "','" &
[Link] & "','" & [Link] & "','" & [Link] & "','" &
[Link] & "','" & [Link] & "','" & [Link] & "','" &
[Link] & "','" & [Link] & "','" & [Link] & "') "
cmd = New [Link](str, con)
28
z = [Link]
MsgBox("Inserted Successfully")
Catch ex As Exception
End Try
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link]()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles
[Link]
End
End Sub
Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs)
Handles [Link]
If Val([Link]) <= 5000 Then
[Link] = Val([Link]) * 2 / 100
[Link] = Val([Link]) * 3 / 100
[Link] = Val([Link]) * 2 / 100
[Link] = Val([Link]) * 2 / 100
ElseIf Val([Link]) < 2000 Then
[Link] = Val([Link]) * 3 / 100
[Link] = Val([Link]) * 4 / 100
[Link] = Val([Link]) * 3 / 100
29
[Link] = Val([Link]) * 3 / 100
Else
[Link] = Val([Link]) * 4 / 100
[Link] = Val([Link]) * 5 / 100
[Link] = Val([Link]) * 4 / 100
[Link] = Val([Link]) * 4 / 100
End If
End Sub
Private Sub TextBox6_TextChanged(sender As Object, e As EventArgs)
Handles [Link]
[Link] = Val([Link]) + Val([Link]) +
Val([Link])
[Link] = Val([Link]) - Val([Link]) -
Val([Link])
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim z As Integer
Try
con = New
[Link]("Provider=[Link].12.0;Data
Source=E:\Programs\MCA\Sem V\.NET\EX6\[Link]")
[Link]()
cmd = New [Link]("delete * from tbl_ex6 where
fld_eid=" & Val([Link]) & ")", con)
z = [Link]
MsgBox("Record Deleted")
Catch ex As Exception
End Try
[Link]()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
[Link]
Try
30
con = New
[Link]("Provider=[Link].12.0;Data
Source=E:\Programs\MCA\Sem V\.NET\EX6\[Link]")
[Link]()
cmd = New [Link](" select * from tbl_ex6 where
fld_eid = " & Val([Link]) & "", con)
d = [Link]
While [Link]
[Link] = d(0)
[Link] = d(1)
[Link] = d(2)
[Link] = d(3)
[Link] = d(4)
[Link] = d(5)
[Link] = d(6)
[Link] = d(7)
[Link] = d(8)
[Link] = d(9)
End While
Catch ex As Exception
End Try
[Link]()
[Link]()
End Sub
End Class
Structure EMP
Public eid As Integer
Public ename As String
Public department As String
Public basicpay, hra, da, pf, tax, grosspay, netpay As Long
End Structure
31
Output:-
Result:-
Thus the Program for creating and open Database has been executed
successfully.
32
[Link]
Create, Read, Update and Delete a Database using [Link]
AIM:-
To write a program for Create, Read, Update and Delete a Database
using [Link]
PROCEDURE:-
STEP1 : Start the Project
STEP2 : Open Microsoft Visual Studio 2010 ->File ->New -> Windows
Application and click ok
STEP3 : Open form1 and place the Text Box and labels and Buttons
STEP4 : To Connect the [Link] Connection in Button
STEP5 : To Create a Database in MS Access
STEP6 : Save the Application and Run the Application
STEP7 : Stop the Project.
Source Code:-
Imports [Link]
Public Class Form1
Dim con As New OleDbConnection
Dim cmd As New OleDbCommand
Dim d As OleDbDataReader
Dim str As String
Dim n, i, a, x As Integer
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
Try
str = "insert into tbl_ex7 values(" & [Link] & ",'" &
[Link] & "','" & [Link] & "'," & [Link] & "," &
[Link] & "," & [Link] & "," & [Link] & "," &
[Link] & ",'" & [Link] & "')"
cmd = New OleDbCommand(str, con)
i = [Link]
MsgBox("inserted successfully")
Catch ex As Exception
End Try
33
str = "select * from tbl_ex7"
Dim adapt As New OleDbDataAdapter(str, con)
Dim ds As New DataSet
[Link](ds, "tbl_ex7")
[Link] = [Link](0)
End Sub
Private Sub TextBox5_LostFocus(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link] = Val([Link]) + Val([Link]) +
Val([Link])
[Link] = Val([Link]) / 3
If Val([Link]) >= 40 And Val([Link]) >= 40 And
Val([Link]) >= 40 Then
[Link] = "Pass"
Else
[Link] = "Re-Appear"
End If
End Sub
Private Sub Button2_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
str = "update tbl_ex7 set frollno=" & [Link] & ",fname='" &
[Link] & "',fcourse='" & [Link] & "',fm1=" &
[Link] & ",fm2=" & [Link] & ",fm3=" & [Link] &
",ftot=" & [Link] & ",favg=" & [Link] & ",fres='" &
[Link] & "' where frollno=" & [Link] & ""
cmd = New OleDbCommand(str, con)
i = [Link]
MsgBox("Updated Successfully ...")
str = "select * from tbl_ex7"
Dim adapt As New OleDbDataAdapter(str, con)
Dim ds As New DataSet
[Link](ds, "tbl_ex7")
[Link] = [Link](0)
End Sub
34
Private Sub Button3_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
str = "delete * from tbl_ex7 where frollno=" & [Link]
cmd = New OleDbCommand(str, con)
i = [Link]
MsgBox("Deleted Successfully ...")
End Sub
Private Sub Form1_Load(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
'TODO: This line of code loads data into the 'Db_7DataSet.tbl_ex7' table.
You can move, or remove it, as needed.
Me.Tbl_ex7TableAdapter.Fill(Me.Db_7DataSet.tbl_ex7)
con = New
OleDbConnection("Provider=[Link].12.0;Data
Source=E:\Programs\MCA\Sem V\.NET\RecEx7\db_7.accdb")
[Link]()
End Sub
Private Sub Button4_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
End Class
35
Output:-
Result:-
Thus the Program for Create, Read, Update and Delete a Database
has been executed successfully
36
[Link]
[Link]
Create a Master Page to serve as a Template For the webpage
Aim:-
To write a program for master page using [Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –> Web
application ->Ok
Step3 : To design the webpage using image, content place holder, Menu
bar
Step4 : Add give navigate URL link to one page to another page
Step5 : Save and Run the Application
Step6 : Stop the Project
Form Design:-
37
SOURCE CODE:-
[Link]
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="[Link]" Inherits="home.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link]
<html xmlns="[Link]
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-size:x-large;
font-weight:bold;
}
.style2
{
font-family:Arial,Helvetica,sans-serif;
font-weight:bold;
}
.style4
{
text-decoration:underline;
font-size:medium;
}
.style3
{
font-family:Arial,Helvetica,sans-serif;
}
.style5
{
font-size:medium;
}
.style6
38
{
font-weight:bold;
font-size:medium;
}
</style>
</head>
<body bgcolor="white" background="[Link]" alink="Black">
<form id="form1" runat="server">
<div align="center" class="b">
<span class="style1"><a href="[Link]" style="text-
decoration:none">HOME </a></span> &nb
sp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">COMPUTER </a></span> &nbs
p;
<span class="style1"><a href="[Link]" style="text-
decoration:none">SUPPORTIVE </a></span> &n
bsp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">COMMON </a></span>
<span class="style6">
<p class="style2">A Digital library is a library in which collections are stored
in digital formats (as opposed to print, microformor other media) and accessible
by computers. The content may be stored locally, or accessed remotely. The
first published use of the term mqy have been in a 1988 report to the
Corporation for National Research Initiative. The term was first popularized by
the NSF/DARPA/NASA Digital Libraries Initiative in [Link](1945)created
a vision based on experience("Digital Library.")</p>
</span>
</div>
</form>
</body>
</html>
39
[Link]
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="[Link]" Inherits="[Link]" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link]
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
font-size:x-large;
font-weight:bold;
}
.style2
{
font-family:Arial,Helvetica,sans-serif;
font-weight:bold;
}
.style4
{
text-decoration:underline;
font-size:medium;
}
.style3
{
font-family:Arial,Helvetica,sans-serif;
}
.style5
{
font-size:medium;
}
.style6
{
40
font-weight:bold;
font-size:medium;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<span class="style1"><a href="[Link]" style="text-
decoration:none">HOME </a></span> &nb
sp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">COMPUTER </a></span> &nbs
p;
<span class="style1"><a href="[Link]" style="text-
decoration:none">SUPPORTIVE </a></span> &n
bsp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">COMMON </a></span>
<span class="style6">
</span>
<center><table border="3" align="center">
<tr>
<td>DETAILS</td>
</tr><br/>
<tr>
<td>BOOK NAME</td>
</tr><br/>
<tr>
<td>MBA</td>
</tr><br/>
<tr>
<td>AUTHOR:SUBRAMANIYAM</td>
</tr><br/>
41
<tr>
<td>EDITION:5 ed</td>
</tr><br/>
<tr>
<td>PUBLICATION:MURUGAN PUBLICATION</td>
</tr><br/>
</table></center>
</div>
</form>
</body>
</html>
[Link]:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="[Link]" Inherits="[Link]" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link]
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
font-size:x-large;
font-weight:bold;
}
.style2
{
font-family:Arial,Helvetica,sans-serif;
font-weight:bold;
}
.style4
{
text-decoration:underline;
font-size:medium;
42
}
.style3
{
font-family:Arial,Helvetica,sans-serif;
}
.style5
{
font-size:medium;
}
.style6
{
font-weight:bold;
font-size:medium;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<span class="style1"><a href="[Link]" style="text-
decoration:none">HOME </a></span> &nb
sp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">COMPUTER </a></span> &nbs
p;
<span class="style1"><a href="[Link]" style="text-
decoration:none">SUPPORTIVE </a></span> &n
bsp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">COMMON </a></span>
<span class="style6">
</span>
<center><table border="3" align="center">
<tr>
43
<td>DETAILS</td>
</tr><br/>
<tr>
<td>BOOK NAME</td>
</tr><br/>
<tr>
<td>SCINCE WORLD</td>
</tr><br/>
<tr>
<td>AUTHOR:KATHIRVEL MURUGAN</td>
</tr><br/>
<tr>
<td>EDITION:5 ed</td>
</tr><br/>
<tr>
<td>PUBLICATION:MURUGAVEL PUBLICATION</td>
</tr><br/>
</table></center>
</div>
</form>
</body>
</html>
OUTPUT:
44
Result:-
Thus the above program using master page has been executed
successfully
45
[Link]
Create Admin page for browsing, Updating & Deleting Records
Aim:-
To write a program for Admin page using [Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –> Web
application ->Ok
Step3 : To create a database and connect the database in our webpage
Step4 : Adding controls in a Webpage
Step5 : Choose the appropriate database data store and connect
Step6 : Save and Run the Application
Step7 : Stop the Project
FORM DESIGN:
46
SOURCE CODE:
[Link]
Imports [Link]
Partial Class _Default
Inherits [Link]
Protected Sub NEWUSER_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link]("[Link]")
End Sub
Protected Sub LOGIN_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
cn = New OleDbConnection("Provider=[Link].4.0;Data
Source=E:\.net labprogram\[Link]")
[Link]()
cmd = New OleDbCommand("select Count(username) from Table1 where
username='" + [Link] + "' and password='" + [Link] + "'", cn)
Dim i As Integer = [Link]()
If (i > 0) Then
[Link]("[Link]")
Else
[Link] = True
[Link] = " Password Incorrect "
End If
End Sub
Protected Sub CANCEL_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link] = ""
[Link] = ""
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link] = False
End Sub
47
End Class
[Link]
Imports [Link]
Partial Class Default2
Inherits [Link]
Protected Sub OK_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
cn = New OleDbConnection("Provider=[Link].4.0;Data
Source=E:\.net labprogram\[Link]")
[Link]()
str = "insert into Table1 values('" + [Link] + "','" + [Link] +
"','" + [Link] + "')"
cmd = New OleDbCommand(str, cn)
[Link]()
[Link]()
[Link]("[Link]")
End Sub
Protected Sub CANCEL_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
End Class
[Link]
Imports [Link]
Partial Class Default3
Inherits [Link]
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
48
Public ha As OleDbDataAdapter
Public hc As OleDbCommandBuilder
Dim I As Integer
Dim ds As New [Link]
Protected Sub INSERT_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
Protected Sub SAVE_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
cn = New OleDbConnection("Provider=[Link].4.0;Data
Source=E:\.net labprogram2\[Link]")
[Link]()
str = "insert into Table1 values('" + [Link] + "','" + [Link] +
"','" + [Link] + "','" + [Link] + "','" + [Link] + "','" +
[Link] + "','" + [Link] + "')"
cmd = New OleDbCommand(str, cn)
[Link]()
MsgBox("success")
End Sub
Protected Sub DELETE_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
cn = New OleDbConnection("Provider=[Link].4.0;Data
Source=E:\.net labprogram2\[Link]")
[Link]()
str = "delete * from Table1 where(cno='" + [Link] + "')"
cmd = New OleDbCommand(str, cn)
[Link]()
[Link]()
49
MsgBox("Records Successfuly Deleted")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
cn = New OleDbConnection("Provider=[Link].4.0;Data
Source=E:\.net labprogram2\[Link]")
[Link]()
End Sub
Protected Sub UPDATE_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
cn = New OleDbConnection("Provider=[Link].4.0;Data
Source=E:\.net labprogram2\[Link]")
[Link]()
str = "update Table1 set cname='" + [Link]() + "' where cno='" +
[Link]() + "'"
cmd = New OleDbCommand(str, cn)
[Link]()
MsgBox("Records Successfuly Updated")
[Link]()
End Sub
Protected Sub DISPLAY_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
Dim s As String
s = InputBox("Enter the rollno for display")
str = "Select * from Table1 where cno='" + [Link]() + "'"
ha = New OleDbDataAdapter(str, cn)
hc = New OleDbCommandBuilder(ha)
[Link](ds)
If [Link](0).[Link] > 0 Then
[Link] = [Link](0).Rows(0).Item("cno").ToString()
[Link] = [Link](0).Rows(0).Item("cname").ToString()
[Link] = [Link](0).Rows(0).Item("cadd").ToString()
[Link] = [Link](0).Rows(0).Item("lastreading").ToString()
[Link] = [Link](0).Rows(0).Item("currentreading").ToString()
[Link] = [Link](0).Rows(0).Item("unit read").ToString()
50
[Link] = [Link](0).Rows(0).Item("total").ToString()
End If
[Link]()
End Sub
Protected Sub CALCULATE_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link] = Val([Link]) - Val([Link])
If ([Link]) >= 100 Then
[Link] = Val([Link]) * 1.5
ElseIf ([Link]) >= 200 Then
[Link] = Val([Link]) * 2.5
ElseIf ([Link]) >= 300 Then
[Link] = Val([Link]) * 3.5
ElseIf ([Link]) >= 400 Then
[Link] = Val([Link]) * 4.5
Else
[Link] = Val([Link]) * 6
End If
End Sub
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link]("[Link]")
End Sub
End Class
[Link]
Partial Class Default4
Inherits [Link]
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
[Link]("[Link]")
End Sub
End Class
51
OUTPUT:
Result:-
Thus the above program using Admin page has been executed
successfully.
52
[Link]
Create a Simple Website
Aim:-
To write a program for Web page using [Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –> Web
application ->Ok
Step3 : Add a New item then select master page place the context place
holder and image
Step4 : To design the webpage using image, content place holder, Menu
bar
Step5 : Save and Run the Application
Step6 : Stop the Project
FORM DESIGN:
53
SOURCE CODE:
[Link]
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="[Link]" Inherits="Web1.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link]
<html xmlns="[Link] dir="b">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-size:x-large;
font-weight:bold;
}
.style2
{
font-family:Arial,Helvetica,sans-serif;
font-weight:bold;
}
.style4
{
text-decoration:underline;
font-size:medium;
}
.style3
{
font-family:Arial,Helvetica,sans-serif;
}
.style5
{
font-size:medium;
}
.style6
54
{
font-weight:bold;
font-size:medium;
}
</style>
</head>
<body bgcolor="red" background="[Link]" alink="Black">
<form id="form1" runat="server">
<div align="center" class="b">
<span class="style1"><a href="[Link]" style="text-
decoration:none">HOME </a></span> &nb
sp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">BOOKS </a></span> &n
bsp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">FRIENDS </a></span>
<span class="style1"><a href="[Link]" style="text-
decoration:none">PERSONALDETAIL </a></span>&nb
sp;
</div>
</form>
</body>
</html>
[Link]:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="[Link]" Inherits="[Link]" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link]
<html xmlns="[Link]
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
55
{
font-size:x-large;
font-weight:bold;
}
.style2
{
font-family:Arial,Helvetica,sans-serif;
font-weight:bold;
}
.style4
{
text-decoration:underline;
font-size:medium;
}
.style3
{
font-family:Arial,Helvetica,sans-serif;
}
.style5
{
font-size:medium;
}
.style6
{
font-weight:bold;
font-size:medium;
}
</style>
</head>
<body bgcolor="red" background="[Link]" alink="Black">
<form id="form2" runat="server">
<div align="center" class="b">
56
<span class="style1"><a href="[Link]" style="text-
decoration:none">HOME </a></span> &nb
sp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">BOOKS </a></span> &n
bsp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">FRIENDS </a></span>
<span class="style1"><a href="[Link]" style="text-
decoration:none">PERSONALDETAIL </a></span>&nb
sp;
<table border="3" align="center">
<tr>
<td>OPERATING SYSTEM</td>
</tr><br>
<tr>
<td>SOFT COMPUTING</td>
</tr><br>
<tr>
<td>MOBILE COMPUTING</td>
</tr><br>
<tr>
<td>PROGRAMMING IN C#</td>
</tr><br>
<tr>
<td>PROGRAMMING IN [Link]</td>
</tr><br>
<tr>
<td>SOFTWARE PROJECT MANAGEMENT</td>
</tr><br>
</table>
</div>
</form>
</body>
57
</html>
[Link]:
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="[Link]" Inherits="[Link]" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link]
<html xmlns="[Link]
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-size:x-large;
font-weight:bold;
}
.style2
{
font-family:Arial,Helvetica,sans-serif;
font-weight:bold;
}
.style4
{
text-decoration:underline;
font-size:medium;
}
.style3
{
font-family:Arial,Helvetica,sans-serif;
}
.style5
{
font-size:medium;
}
.style6
58
{
font-weight:bold;
font-size:medium;
}
</style>
</head>
<body bgcolor="pink" background="[Link]" alink="Black">
<form id="form1" runat="server">
<div align="center" class="b">
<span class="style1"><a href="[Link]" style="text-
decoration:none">HOME </a></span> &nb
sp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">BOOKS </a></span> &n
bsp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">FRIENDS </a></span>
<span class="style1"><a href="[Link]" style="text-
decoration:none">PERSONALDETAIL </a></span>&nb
sp;
<table border="3" align="center">
<tr>
<td>FRIEND NAME</td>
</tr><br>
<tr>
<td>[Link]</td>
</tr><br>
<tr>
<td>[Link]</td>
</tr><br>
<tr>
<td>[Link]</td>
</tr><br>
<tr>
59
<td>[Link] MARY</td>
</tr><br>
<tr>
<td>[Link]</td>
</tr><br>
<tr>
<td>[Link]</td>
</tr><br>
</table>
</div>
</form>
</body>
</html>
[Link]
<%@ Page Language="vb" AutoEventWireup="false"
CodeBehind="[Link]" Inherits="[Link]" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[Link]
<html xmlns="[Link]
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-size:x-large;
font-weight:bold;
}
.style2
{
font-family:Arial,Helvetica,sans-serif;
font-weight:bold;
}
.style4
{
60
text-decoration:underline;
font-size:medium;
}
.style3
{
font-family:Arial,Helvetica,sans-serif;
}
.style5
{
font-size:medium;
}
.style6
{
font-weight:bold;
font-size:medium;
}
</style>
</head>
<body bgcolor="red" background="[Link]" alink="Black">
<form id="form1" runat="server">
<div align="center" class="b">
<span class="style1"><a href="[Link]" style="text-
decoration:none">HOME </a></span> &nb
sp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">BOOKS </a></span> &n
bsp;
<span class="style1"><a href="[Link]" style="text-
decoration:none">FRIENDS </a></span>
<span class="style1"><a href="[Link]" style="text-
decoration:none">PERSONALDETAIL </a></span>&nb
sp;
<table border="3" align="center">
<tr>
61
<td>NAME:[Link] RITA MARY</td>.
</tr><br>
<tr>
<td>FATHER NAME:[Link] RAJ</td>
</tr><br>
<tr>
<td>MOTHER NAME:[Link] MARY</td>
</tr><br>
<tr>
<td>HOBBIES:READING BOOKS<br />LISENING MUSIC</td>
</tr><br>
<tr>
<td>I AM STUDING IN MCA</td>
</tr><br>
<tr>
<td>ADDRESS:3/1 NARANAMPALAYAM<br
/>KAMALAPURAM(P.O)<br />OMALUR(T.K)<br />SALEM(D.T)</td>
</tr><br>
<tr>
<td>PHONE NUMBER:9443194446<br />9442614446</td>
</tr><br>
<tr>
<td>EMAIL ID:carolinkamathi@[Link]</td>
</tr><br>
</table>
</div>
</form>
</body>
</html>
62
OUTPUT:
Result:-
Thus the above program for simple web page has been executed
successfully.
63
[Link]
Creating and open connection in database using ADO>.NET
Aim:-
To write a program for create and open database using [Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –> Web
application ->Ok
Step3 : To create a database and connect the database in our webpage
Step4 : Adding controls in a webpage such as object source
Step5 : Choose the appropriate database data store and connected the
Control
Step6 : Save and Run the Application
Step7 : Stop the Project
FORM DESIGN:
SOURCE CODE:
Imports [Link]
Public Class WebForm1
Inherits [Link]
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
Dim dr As OleDbDataReader
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
64
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
str = "insert into Table1 values('" & [Link] & "','" & [Link] &
"','" & [Link] & "','" & [Link] & "')"
cmd = New OleDbCommand(str, con)
[Link]()
[Link]()
MsgBox("Stored Success")
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
cmd = New OleDbCommand("select * from Table1", con)
Dim adapt As New OleDbDataAdapter(str, con)
Dim ds As New DataSet
[Link] = True
[Link]()
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
Dim i As Integer
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
65
str = "delete * from Table1 where regno=" & Val(InputBox("Enter the
Regno:"))
cmd = New OleDbCommand(str, con)
[Link]()
MsgBox("Delete Success")
End Sub
End Class
OUTPUT:
Result:-
Thus the above program Create and Open Database using [Link]
has been executed successfully.
66
[Link]
Create, Read, Update, Delete Records in Database using [Link]
Aim:-
To write a program for Create, Read, Update, Delete Records in
Database
Using [Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –> Web
application ->Ok
Step3 : To create a database and connect the database in our webpage
Step4 : Adding controls in a webpage such as object source
Step5 : Choose the appropriate database data store and connected the
Control
Step6 : Save and Run the Application
Step7 : Stop the Project
FORM DESIGN:
SOURCE CODE:
Imports [Link]
Public Class WebForm1
Inherits [Link]
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
67
Dim dr As OleDbDataReader
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
str = "insert into Table1 values('" & [Link] & "','" & [Link] &
"','" & [Link] & "','" & [Link] & "')"
cmd = New OleDbCommand(str, con)
[Link]()
[Link]()
MsgBox("Stored Success")
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
cmd = New OleDbCommand("select * from Table1", con)
Dim adapt As New OleDbDataAdapter(str, con)
Dim ds As New DataSet
[Link] = True
[Link]()
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
68
[Link]()
str = "delete * from Table1 where regno=" & Val(InputBox("Enter the
Regno:"))
cmd = New OleDbCommand(str, con)
[Link]()
MsgBox("Delete Success")
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
str = "update Table1 set regno=" & [Link] & ",name='" &
[Link] & "',address='" & [Link] & "',course='" &
[Link] & "' where regno=" & [Link] & ""
cmd = New OleDbCommand(str, con)
[Link]()
MsgBox("Update Success")
End Sub
End Class
OUTPUT:
69
Result:-
Thus the above program Create, Read, Update, Delete Records in
Database
Using [Link] has been executed successfully.
70
[Link]
SQL Database for Populate a Drop Down list and Grid View
Aim:-
To write a program for SQL Database for Populate a Drop Down list and
Grid View Using [Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –> Web
application ->Ok
Step3 : To create a database and connect the database in our webpage
Step4 : Adding controls in a webpage
Step5 : Choose the appropriate database data store and connected the
Control
Step6 : Save and Run the Application
Step7 : Stop the Project
FORM DESIGN:
SOURCE CODE:
Imports [Link]
Imports [Link]
Public Class WebForm1
Inherits [Link]
Dim con As New [Link]
Dim cmd As New [Link]
Dim adp As New [Link]
71
Dim ds As New DataSet()
Dim tbl As New Table
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
[Link] = ("Data
Source=carolin;AttachDbFilename=C:\Users\HP
246\Documents\[Link];Integrated Security=True")
[Link]()
adp = New SqlDataAdapter("select * from Table1 where name='" +
[Link] + "'", con)
[Link](ds, "Table1")
[Link] = [Link]("Table")
[Link]()
[Link]()
End Sub
End Class
OUTPUT:
Result:-
Thus the above program SQL Database for Populate a Drop Down list
and Grid View Using [Link] has been executed successfully.
72
[Link]
Object Data store to populate a Grid View
Aim:-
To write a program for Object Data Store to Populate Grid View in
[Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –> Web
application ->Ok
Step3 : To create a database and connect the database in our webpage
Step4 : Adding the controls in a webpage
Step5 : Choose the appropriate database data store and connected the
Control
Step6 : Save and Run the Application
Step7 : Stop the Project
FORM DESIGN:
SOURCE CODE:
Imports [Link]
Public Class WebForm1
Inherits [Link]
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim str As String
73
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
str = "insert into Table1 values('" & [Link] & "','" & [Link] &
"','" & [Link] & "','" & [Link] & "','" & [Link] & "','"
& [Link] & "','" & [Link] & "')"
cmd = New OleDbCommand(str, con)
[Link]()
[Link]()
MsgBox("Stored Success")
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles [Link]
con = New OleDbConnection("Provider=[Link].4.0;Data
Source=C:\Users\HP 246\Documents\[Link]")
[Link]()
cmd = New OleDbCommand("select * from Table1", con)
Dim adp As New OleDbDataAdapter(str, con)
Dim ds As New DataSet
[Link] = True
74
[Link]()
End Sub
End Class
OUTPUT:
Result:-
Thus the above program Data Store to Populate Grid View in
[Link] has been executed successfully.
75
[Link]
FEEDBACK FORM
Aim:-
To write a program for Feedback Form in [Link]
Procedure:-
Step1 : Start the project
Step2 : Open the Microsoft Visual Studio 2010 ->File -> new –>
Web application ->Ok
Step3 : To create a database and connect the database in our webpage
Step4 : Adding the controls in a webpage
Step5 : Choose the appropriate database data store and connected the
Control
Step6 : Save and Run the Application
Step7 : Stop the Project
[Link]:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="[Link]" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"[Link]
<script language="javascript" >
function ValidateComments(sender,args)
{
if([Link] > 10)
[Link]=false;
else
[Link]=true;
}
</script>
<html xmlns="[Link] >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
76
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-
Size="XX-Large" ForeColor="Maroon"
Text="FEED BACK FORM" Width="304px"></asp:Label>
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="3"
BackColor="#FFFBD6" BorderColor="#FFDFAD"
BorderWidth="1px" Font-Names="Verdana" Font-Size="XX-Large"
Height="336px" Style="position: static"
Width="704px" Font-Bold="True" ForeColor="#0000C0">
<StepStyle VerticalAlign="Top" />
<SideBarStyle BackColor="#990000" Font-Size="0.9em"
VerticalAlign="Top" Width="100px" />
<NavigationButtonStyle BackColor="White" BorderColor="#CC9966"
BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#990000" />
<WizardSteps>
<asp:WizardStep runat="server" Title="Contact Info">
<table cellpadding="10">
<tr>
<td style="width: 100px">
Your Name</td>
<td style="width: 100px">
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
</td>
<td style="width: 100px">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="txtName"
ErrorMessage="Please entere the
name">*</asp:RequiredFieldValidator>
77
</td>
</tr>
<tr>
<td style="width: 100px">
Email</td>
<td style="width: 100px">
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
</td>
<td style="width: 100px">
<asp:RequiredFieldValidator ID = "Required Field Validator 2" runat =
"server" ControlToValidate="txtEmail"
ErrorMessage="You must enter the vaild email
address">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtEmail"
ErrorMessage="Enter valid Email address(you@[Link])"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-
.]\w+)*">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td colspan="2">
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
Width="216px" />
</td>
</tr>
</table>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Comments">
<table>
<tr>
<td style="width: 100px; height: 50px">
Comments(not more than 10 char)</td>
78
<td style="width: 100px; height: 50px">
<asp:TextBox ID="txtComments" runat="server"
TextMode="MultiLine"></asp:TextBox>
</td>
<td style="width: 100px; height: 50px">
<asp:CustomValidator ID="CustomValidator1" runat="server"
ClientValidationFunction="ValidateComments"
ControlToValidate="txtComments" ErrorMessage="Not more than 10
Charaters please">*</asp:CustomValidator>
</td>
</tr>
<tr>
<td style="width: 100px">
Rating( 1-5)</td>
<td style="width: 100px">
<asp:TextBox ID="txtRating" runat="server"></asp:TextBox>
</td>
<td style="width: 100px">
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="txtRating"
ErrorMessage="Use the rating between 1to 5" MaximumValue="5"
MinimumValue="1">*</asp:RangeValidator>
</td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td colspan="2">
<asp:ValidationSummary ID="ValidationSummary2" runat="server"
Width="208px" />
</td>
</tr>
</table>
</asp:WizardStep>
<asp:WizardStep runat="server" StepType="Finish" Title="Summary">
79
(Show example)</asp:WizardStep>
<asp:WizardStep runat="server" StepType="Complete"
Title="Complete">
</asp:WizardStep>
</WizardSteps>
<SideBarButtonStyle ForeColor="White" />
<HeaderStyle BackColor="#FFCC66" BorderColor="#FFFBD6"
BorderStyle="Solid" BorderWidth="2px"
Font-Bold="True" Font-Size="0.9em" ForeColor="#333333"
HorizontalAlign="Center" />
<SideBarTemplate>
<asp:DataList ID="SideBarList" runat="server">
<SelectedItemStyle Font-Bold="True" />
<ItemTemplate>
<asp:LinkButton ID="SideBarButton" runat="server"
ForeColor="White"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
</SideBarTemplate>
</asp:Wizard>
</div>
</form>
</body>
</html>
[Link]:
Imports [Link]
Imports [Link]
Imports [Link]
Partial Class _Default
Inherits [Link]
Protected Sub CustomValidator1_ServerValidate(ByVal source As
Object, ByVal args As System.
[Link]) Handles Custom
Validator [Link]
80
If [Link] > 10 Then
[Link] = False
Else
[Link] = True
End If
End Sub
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object,
ByVal e As [Link])
Handles [Link]
SendMail([Link], [Link])
MsgBox("Mail has been send successfully")
End Sub
Private Sub SendMail(ByVal from As String, ByVal body As String)
Dim mm As New [Link]
[Link] = True
[Link] = "[Link]"
Dim cred As New
[Link]("example@[Link]","examplepassw
ord") [Link] = cred
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
[Link]) Handles [Link]
End Sub
End Class
81
OUTPUT
RESULT:
Thus the above program Feedback Form in [Link] has been
executed successfully.
82