Open website: https://visualstudio.microsoft.com/downloads/ and download Visual Studio 2022 Community edition (if not installed).
In case of limited resources available on your PC/laptop/notebook you may check https://visualstudio.microsoft.com/vs/older-downloads/ for previous versions.
Run the installer for Visual Studio.
Select ASP.NET and Web Development. Also select .NET Framework project and item templates, .NET Framework 4.6.2–4.7.1 development tools and Additional project templates (previous versions).
Go to https://www.microsoft.com/en-us/sql-server/sql-server-downloads and download SQL Server Developer or SQL Server Express edition. Follow its instructions for installation.
SQL Server 2022 Developer is a full-featured free edition, licensed for use as a development and test database in a non-production environment.
SQL Server 2022 Express is a free edition of SQL Server, ideal for development and production for desktop, web, and small server applications.
In case of limited resources check https://learn.microsoft.com/en-us/previous-versions/sql/ .
Go to website: https://aka.ms/ssmsfullsetup to download SQL Server Management Studio.
Install SQL Server Management Studio SSMS by executing SSMS-Setup-ENU file.
Consider the project database designed and implemented during previous semester i.e. Fall 2024. Its implementation was done using structured query language during previous semester. Try to recall major relations in your project database. You already have its report in printed form.
Connect and query a SQL Server instance using Visual Studio.
Follow the instructions https://learn.microsoft.com/en-us/ssms/quickstarts/ssms-connect-query-sql-server .
Code Behind File
Imports System.Web.UI
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits Page
Protected Sub Retrieval(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
' Modify the connection string to use Windows Authentication
Dim cons As String
cons = "workstation id=zoyazahradb.mssql.somee.com;packet size=4096;user id=ZoyaZahra_SQLLogin_1;pwd=fjlk3wtfa3;data source=zoyazahradb.mssql.somee.com;persist security info=False;initial catalog=zoyazahradb;TrustServerCertificate=True"
' Create and open the connection
Dim con As New SqlConnection(cons)
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.CommandText = "SELECT Customer_id, Email, Name, Cell_NO, Country From Customer"
' Declare the DataReader
Dim dr As SqlDataReader
Try
' Open the connection
con.Open()
' Execute the query
dr = cmd.ExecuteReader()
' Read and display the data
' Start the table
Response.Write("<table border='1'>")
Response.Write("<tr><th>Customer ID</th><th>Name</th><th>Email</th><th>Cell No</th><th>Country</th></tr>")
' Loop through the data
While (dr.Read())
Response.Write("<tr>")
Response.Write("<td>" & dr("Customer_Id") & "</td>")
Response.Write("<td>" & dr("Name") & "</td>")
Response.Write("<td>" & dr("Email") & "</td>")
Response.Write("<td>" & dr("Cell_NO") & "</td>")
Response.Write("<td>" & dr("Country") & "</td>")
Response.Write("</tr>")
End While
' End the table
Response.Write("</table>")
Catch ex As Exception
' Display error message in case of an issue
Response.Write("An error occurred: " & ex.Message)
Finally
' Cleanup
If Not dr Is Nothing Then
dr.Close()
End If
con.Close()
cmd.Dispose()
End Try
End Sub
End Class
Default.aspx File
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>SQL QUERY</title>
<style type="text/css">
#Button1 {
width: 111px;
height: 51px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>DATA RETRIEVAL</h2>
<asp:Label ID="query" runat="server" Text="Following data has been fetched"></asp:Label>
</div>
</form>
<p>
</p>
<p>
</p>
<p>
</body>
</html>