Monday 28 September 2015

How to Add,Update,Delete and Clear records in Database (Ms Access) with ...

How to add,Update ,Delete and Clear records in Ms Access Database using ADODC control -An Advanced Visual Basic Application (Step by step full tutorial with explanation of each step).

This tutorial is focused on following points.

* How to create a simple database with MS Access.

*How to add ADODC Control on the Visual Basic Toolbox.

*How to use the ADODC control and set the properties and establish database connection using Ms Access .

*How to set the properties of each fields according to database application.

*How to hide ADODC control.

*How to add Record navigation buttons i.e First,Previous,Next,Last.

*How to perform Database Operation i.e ADD Record,Delete Record,Update Record and Clear the records.



In this tutorial,every step is explained with supportive text within the video.so everyone can follow the steps to build such applications quite easily.

if you have any queries,suggestions or problems,please leave a comments.

Do share and Subscribe to my channel :-)









Source Code:


ADD RECORD:

Private Sub Addbtn_Click()

Studentdb.Recordset.AddNew

End Sub

CLEAR RECORD:

Private Sub cancelbtn_Click()

txtroll.Text = ""

txtname.Text = ""

txtclass.Text = ""

txtadd.Text = ""

txtemail.Text = ""

txtphone.Text = ""

End Sub

DELETE RECORD

Private Sub delbtn_Click()

confirmation = MsgBox("Do you want to delete this record", vbYesNo + vbCritical, "Delete Record Confirmation")

If confirmation = vbYes Then

Studentdb.Recordset.Delete

MsgBox "Record has been deleted Successfully", vbInformation, "Message"

Else

MsgBox "Record Not Delete !!!", vbInformation, "Message"

End If

End Sub

UPDATE RECORD:

Private Sub updatebtn_Click()

Studentdb.Recordset.Fields("RollNo") = txtroll.Text

Studentdb.Recordset.Fields("Name") = txtname.Text

Studentdb.Recordset.Fields("Class") = txtclass.Text

Studentdb.Recordset.Fields("Address") = txtadd.Text

Studentdb.Recordset.Fields("email") = txtemail.Text

Studentdb.Recordset.Fields("Phone") = txtphone.Text

Studentdb.Recordset.Update

MsgBox "data is saved successfully", vbInformation, "Message"

End Sub

EXIT APPLICATION

Private Sub exitbtn_Click()

Me.Hide

End Sub

FIRST NAVIGATION BUTTON

Private Sub firstbtm_Click()

Studentdb.Recordset.MoveFirst

End Sub

LAST NAVIGATION BUTTON

Private Sub lastbtn_Click()

Studentdb.Recordset.MoveLast

End Sub

NEXT NAVIGATION BUTTON

Private Sub nxtbtn_Click()

Studentdb.Recordset.MoveNext

End Sub

PREVIOUS NAVIGATION BUTTON

Private Sub prevbtn_Click()

Studentdb.Recordset.MovePrevious

End Sub

Wednesday 23 September 2015

A Simple Visual Basic Database Application using Data Control -Tutorial...

(Browse the information of customers stored in NWIND.mdb Microsoft Access database using data control *without any programming)

Create a simple database application with MS Access Database provided in visual basic installation folder in C Drive.


Videos key points: (Without any programming )


How to link or connect to MS Access database with VB using data control.
How to connect or link our textbox or label with database.
How to hide the data control.
How to add navigation button for moving the records from beginning to last or previous to next etc.



First Step:
Locate the Database
Goto C: Drive and Open Program files.Now Find Microsoft Visual Studio folder.Open it and Select VB98 Folder and Open it also.Here you will find Two Access Databases NWIND.mdb and
BIBLIO.mdb.
Just Copy that files and place in another drive for user.

Step:2
To connect database by Setting data control properties:
Database Name,Access And Record Source.
To display data with Text box or any other control by Setting control properties:
Data Source and Data field.


You will be able to develop the same application after watching this video.
please leave a comment for any suggestion or help.

Subscribe to my Channel:-)