0% found this document useful (0 votes)
67 views

27 Gad

This document describes a VB.NET application for GUI application development that allows inserting, updating, deleting, and searching records in a database table. The application contains buttons to insert a new record into a database table by passing values from textboxes and comboboxes to an SQL insert statement. It also contains buttons to retrieve, update, and delete existing records by executing SQL select, update, and delete statements that take values from or filter by the textboxes and pass parameters. The code examples show how to connect to an Access database and execute SQL commands using OleDb objects.

Uploaded by

Ganesh Ekambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views

27 Gad

This document describes a VB.NET application for GUI application development that allows inserting, updating, deleting, and searching records in a database table. The application contains buttons to insert a new record into a database table by passing values from textboxes and comboboxes to an SQL insert statement. It also contains buttons to retrieve, update, and delete existing records by executing SQL select, update, and delete statements that take values from or filter by the textboxes and pass parameters. The code examples show how to connect to an Access database and execute SQL commands using OleDb objects.

Uploaded by

Ganesh Ekambe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

GUI APPLICATION DEVELOPMENT USING VB.

NET (22034)

Name of Student: Ekambe Ganesh Roll No.: 88

Experiment No.: 27 DOS:

‐---------------‐-----------------------------------------------------------------------------

Code:
Imports System.Data.OleDb

Public Class Form3


Dim con As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand
Dim DR As OleDb.OleDbDataReader

Private Sub Button5_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button5.Click
con = New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=C:\Users\91801\OneDrive\Documents\gramin.mdb")
con.Open()
cmd = New OleDb.OleDbCommand("Insert into gramin
values(' " & TextBox1.Text & " ',' " & TextBox2.Text & "
',' " & TextBox3.Text & " ',' " & TextBox4.Text & " ',' "
& ComboBox1.Text & " ',' " & ComboBox2.Text & " ')", con)
'/cmd = New OleDb.OleDbCommand("Insert into
Student values(@Rollno,@Name,@Fees)", con)
'/ cmd.Parameters.AddWithValue("@Rollno",
TextBox1.Text)
'/cmd.Parameters.AddWithValue("@Name",
TextBox2.Text)
'/cmd.Parameters.AddWithValue("@Fees",
TextBox3.Text)
DR = cmd.ExecuteReader
con.Close()
MsgBox("Record has been inserted Successfully !")
Form4.Show()

End Sub
GUI APPLICATION DEVELOPMENT USING VB.NET (22034)

Private Sub Button8_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button8.Click
con = New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=C:\Users\91801\OneDrive\Documents\gramin.mdb")
con.Open()
cmd = New OleDb.OleDbCommand("Select * from
gramin", con)
DR = cmd.ExecuteReader
While DR.Read()
TextBox1.Text = DR(0)
TextBox2.Text = DR(1)
TextBox3.Text = DR(2)
TextBox4.Text = DR(3)
ComboBox1.Text = DR(4)
ComboBox2.Text = DR(5)
End While

con.Close()

End Sub

Private Sub Button9_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button9.Click

con = New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=C:\Users\91801\OneDrive\Documents\gramin.mdb")
con.Open()
cmd = New OleDb.OleDbCommand("Delete from gramin
where Rollno= @del ", con)
cmd.Parameters.AddWithValue("@del",
InputBox("Enter rollno you want to delete"))
DR = cmd.ExecuteReader
GUI APPLICATION DEVELOPMENT USING VB.NET (22034)
con.Close()
MsgBox("Record has been deleted ")
End Sub

Private Sub Button7_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button7.Click

Dim srch As String = InputBox("enter roll number


")

con = New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=C:\Users\91801\OneDrive\Documents\gramin.mdb")
con.Open()
cmd = New OleDb.OleDbCommand("Select * from gramin
where RollNO =" & srch, con)
DR = cmd.ExecuteReader
While DR.Read()
TextBox1.Text = DR(0)
TextBox2.Text = DR(1)
TextBox3.Text = DR(2)
TextBox4.Text = DR(3)
ComboBox1.Text = DR(4)
ComboBox2.Text = DR(5)
End While

con.Close()
End Sub

Private Sub Label7_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub Button3_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
Form4.Show()
GUI APPLICATION DEVELOPMENT USING VB.NET (22034)
End Sub

Private Sub Label3_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Label3.Click

End Sub

Private Sub Label4_Click(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
Label4.Click

End Sub

Private Sub Panel7_Paint(ByVal sender As


System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel7.Paint

End Sub

Private Sub ComboBox2_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles ComboBox2.SelectedIndexChanged

End Sub

Private Sub TextBox3_TextChanged(ByVal sender As


System.Object, ByVal e As System.EventArgs) Handles
TextBox3.TextChanged

End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal


sender As System.Object, ByVal e As System.EventArgs)
Handles ComboBox1.SelectedIndexChanged

End Sub
End Class
GUI APPLICATION DEVELOPMENT USING VB.NET (22034)

Output
GUI APPLICATION DEVELOPMENT USING VB.NET (22034)

Database

You might also like