


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Database Connectivity coding with VB.net
Typology: Exercises
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Imports System.Data.OleDb Public Class Form Dim con As OleDbConnection Dim ad As OleDbDataAdapter Dim dt As New DataTable Dim r As Integer Dim cmd As OleDbCommandBuilder Dim row As DataRow Private Sub Table1BindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles Table1BindingNavigatorSaveItem.Click Me.Validate() Me.Table1BindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.PayrollPS_DBDataSet) End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'PayrollPS_DBDataSet.Table1' table. You can move, or remove it, as needed. Me.Table1TableAdapter.Fill(Me.PayrollPS_DBDataSet.Table1) con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users
farha\OneDrive\Documents\PayrollPS_DB.accdb") cmd = New OleDbCommandBuilder(ad) Try con.Open() MsgBox("DB Connected Successfully", MsgBoxStyle.Information, "DB connection") Catch ex As Exception MsgBox("DB Not Connected") End Try End Sub Private Sub G_Pay1_Click(sender As Object, e As EventArgs) Handles G_Pay1.Click Gross_PayTextBox.Text = Val(Basic_SalaryTextBox.Text) + Val(HRATextBox.Text) + Val(DATextBox.Text) End Sub Private Sub N_Pay1_Click(sender As Object, e As EventArgs) Handles N_Pay1.Click Net_PayTextBox.Text = Val(Gross_PayTextBox.Text) - Val(DeductionTextBox.Text) End Sub End Class