Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Coding to connect database with VB.net, Exercises of Relational Database Management Systems (RDBMS)

Database Connectivity coding with VB.net

Typology: Exercises

2022/2023

Uploaded on 05/30/2023

mrsmfarhana-fathima
mrsmfarhana-fathima 🇮🇳

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Imports System.Data.OleDb
Public Class Form1
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
pf3
pf4

Partial preview of the text

Download Coding to connect database with VB.net and more Exercises Relational Database Management Systems (RDBMS) in PDF only on Docsity!

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