This assignment assesses the competency 1. Assemble applications for database ac
ID: 3773770 • Letter: T
Question
This assignment assesses the competency 1. Assemble applications for database access. Directions: For this project, you'll create a form that lets the user maintain technicians using text box controls. The design of the Technician Maintenance form Technician Maintenance When this application first starts, the data in the first row of the Technicians table is displayed. Then, the user can display the data for other rows using the navigation buttons in the toolbar. To modify an existing row, the user enters the modifications and then clicks the "Save Data" button in the toolbar. To delete an existing row, the user clicks the "Delete" button in the toolbar, followed by the "Save Data" button. To add a new row, the user clicks the "Add New" button in the toolbar, enters the data for the new row, and then clicks the "Save Data" button. This application should handle SQL Server and ADO.NET exceptions. Because the TechID column is an identity column, don't allow the user to change the value in this column. Limit the number of characters that can be entered into the Name, Email, and Phone text boxes so that the entries don't exceed the sizes allowed by the Name, Email, and Phone columns in the database. Compress the entire program for submission. Submit this assignment to your instructor via the dropbox "LP1.2 Assignment: Maintain Technicians." This assignment is worth 40 points and will be graded according to the scoring guide below.Explanation / Answer
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
DataGridView1.ColumnCount = 3
DataGridView1.Columns(0).Name = "studentid"
DataGridView1.Columns(1).Name = "studentname"
DataGridView1.Columns(2).Name = "branch"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Try
DataGridView1.Rows.Clear()
Dim con As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:UsersrsecDocumentsStudent database.accdb")
con.Open()
Dim cmd As New OleDb.OleDbCommand("select * from student", con,
con.BeginTransaction)
Dim dr = cmd.ExecuteReader
Do While dr.Read
Dim v1 = dr.Item("studentid")
Dim v2 = dr.Item("studentname")
Dim v3 = dr.Item("branch")
DataGridView1.Rows.Add(v1, v2, v3)
Loop
dr.Close()
con.Close()
Catch ex As InvalidOperationException
End Try
End Sub
End Class