Write a VB.NET program to create a player table (PID, PName, Game, no_of_matches). Insert records and update the number of matches of ‘Rohit Sharma’ and display the result in a DataGridView.

Answer:

1. Creating the Player Table in SQL Server
sqlCopyCREATE TABLE Player (
PID INT PRIMARY KEY IDENTITY(1,1),
PName VARCHAR(100),
Game VARCHAR(50),
no_of_matches INT
);
2. VB.NET Code for the Application
<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="Form1.aspx.vb" Inherits="PlayerRecordApp.Form1" %>

<!DOCTYPE html>
<html>
<head runat="server">
    <title>Player Table Operations</title>
</head>
<body>
    <form id="form1" runat="server">
        <h2>Player Table Operations</h2>
        <asp:Button ID="btnInsert" runat="server" Text="Insert Records" OnClick="btnInsert_Click" /><br /><br />
        <asp:Button ID="btnUpdate" runat="server" Text="Update Matches for Rohit Sharma" OnClick="btnUpdate_Click" /><br /><br />
        <asp:GridView ID="gvPlayer" runat="server" AutoGenerateColumns="True" />
    </form>
</body>
</html>
Scroll to Top