Professional Documents
Culture Documents
Third Year
Bachelor of Computer Application (T.Y.B.C.A.)
Semester - V
File Submission
506: Practical of ASP.NET
YEAR: 2022-23
Submitted by
Roll No : 45
Name : Harsh J. Mendapara
Submitted To
Prof. Prashant Ghantiwala
VIMAL TORMAL PODDAR BCA COLLEGE
BACHELOR
OF
COMPUTER APPLICATION
B.C.A
Certificate
1. Develop a web page that accept two numbers (Using Textbox) and make sum
of those numbers and print on textbox.
End Sub
End Sub
End Class
2. Develop a web page that accept two numbers (Using Textbox) and make
Subtraction of those numbers and print on textbox.
End Sub
3. Develop a web page that accept two numbers (Using Textbox) and make
Division of those numbers and print on textbox.
End Sub
4. Develop a web page that accept two numbers (Using Textbox) and make
Multiplication of those numbers and print on textbox.
End Sub
5. Develop a User Registration web page with appropriate fields and save the
record in database table. (Take Appropriate database and table fields)
Imports System.Configuration
Imports MySql.Data.MySqlClient
Else
Try
Dim cmd As New MySqlCommand
cmd.CommandText = str
cmd.Connection = con
MsgBox("Value accepted")
clearform()
Catch ex As Exception
End Try
End If
End Sub
Private Sub clearform()
user_id.Text = String.Empty
f_name.Text = String.Empty
l_name.Text = String.Empty
email.Text = String.Empty
mobile.Text = String.Empty
city.Text = String.Empty
gender.Text = String.Empty
u_name.Text = String.Empty
password1.Text = String.Empty
password2.Text = String.Empty
End Sub
End Class
6. Develop a User Login web page with Login Control and check user name and
password with database table. (Show appropriate msg to user if user name or
password are invalid)
Imports System.Configuration
Imports MySql.Data.MySqlClient
Public Class Que6
Inherits System.Web.UI.Page
da.Fill(dt)
If dt.Rows.Count > 0 Then
'Response.Redirect("Details.aspx")
MsgBox("welcome")
clearform()
Else
ClientScript.RegisterStartupScript(Page.[GetType](),
"validation", "<script language='javascript'>alert('Invalid
Username and Password')</script>")
End If
End Sub
7. Develop a web page that accept students details (Student ID, Student Name,
Area, Mobile, Email, Standard) and save in database record. Show students
records on GridView control and also perform Update and Delete operation.
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
assignment\WebApplication2\WebApplication2\App_Data\student_data.mdf';Integrated
Security=True").ConnectionString
Dim query As String = "SELECT * FROM Customers"
Using con As SqlConnection = New SqlConnection(constr)
Using sda As SqlDataAdapter = New SqlDataAdapter(query, con)
Using dt As DataTable = New DataTable()
sda.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
End Using
End Using
End Using
End Sub
Protected Sub Insert(ByVal sender As Object, ByVal e As EventArgs)
Dim name As String = txtName.Text
Dim country As String = txtCountry.Text
Dim query As String = "INSERT INTO Customers VALUES(@Name, @Country)"
Dim constr As String =
ConfigurationManager.ConnectionStrings("constr").ConnectionString
txtName.Text = ""
txtCountry.Text = ""
Using con As SqlConnection = New SqlConnection(constr)
Using cmd As SqlCommand = New SqlCommand(query)
cmd.Parameters.AddWithValue("@Name", name)
cmd.Parameters.AddWithValue("@Country", country)
cmd.Connection = con
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
Me.BindGrid()
End Sub
End Sub
Protected Sub OnRowUpdating(ByVal sender As Object, ByVal e As
GridViewUpdateEventArgs)
Dim row As GridViewRow = GridView1.Rows(e.RowIndex)
Dim customerId As Integer = Convert.ToInt32(GridView1.DataKeys(e.RowIndex).Values(0))
Dim name As String = (TryCast(row.FindControl("txtName"), TextBox)).Text
Dim country As String = (TryCast(row.FindControl("txtCountry"), TextBox)).Text
Dim query As String = "UPDATE Customers SET Name=@Name, Country=@Country WHERE
CustomerId=@CustomerId"
Dim constr As String =
ConfigurationManager.ConnectionStrings("constr").ConnectionString
Using con As SqlConnection = New SqlConnection(constr)
Using cmd As SqlCommand = New SqlCommand(query)
cmd.Parameters.AddWithValue("@CustomerId", customerId)
cmd.Parameters.AddWithValue("@Name", name)
cmd.Parameters.AddWithValue("@Country", country)
cmd.Connection = con
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
GridView1.EditIndex = -1
Me.BindGrid()
End Sub
cmd.Parameters.AddWithValue("@CustomerId", customerId)
cmd.Connection = con
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
Me.BindGrid()
End Sub