Add,Delete ,Update,Search using VB6 DataGrid- ADODC and Access-Step by Step

Visual Basic Database Application:Add,Delete ,Update,Search Records Using Data Grid -Adodc Control and MS Access 2003-Step by Step
How to add ,delete,Update and Search records in DataGrid control placed on VB form.
How to change the properties to format the Data Grid control.
in this Application,I am using my previous App database (Student Database.mdb).
1.firstly ,Data Grid control and Adodc are not available on toolbox.So add these controls to form for use.
Next make the database connectivity using Adodc.DataGrid Control works only with ADODC control.So you have to use these two control on the form.One Adodc is used for database connectivity and Datagrid is used for display the records in the form of rows and columns.set the datasource property of Data Grid  to name of adodc for displaying the information in the form.
2.Once data is shown on the form,then set the datagrid property for adding ,deleting  and updating the records.
3.Add search capability to the datagrid.You can search the records by entering Name or RollNo in the textbox.if record is not available,it shows message"No Record Found".
4.How to filter the information about the students .
Everything is explained and performed in this application.


If you like my video,Please Hit like button and Subscribe to my channel for latest updates on tutorials.




Source Code:
Delete Record Command Button

Dim confirm As Integer

Private Sub delbtn_Click()
confirm = MsgBox("Do you want to delete the Record", vbYesNo + vbExclamation, "Warning Message")
If confirm = vbYes Then
adogrid.Recordset.Delete
MsgBox "Record Deleted Successfully", vbInformation, "Delete Record Confirmation"
Else
MsgBox "Record Not Deleted", vbInformation, "Record Not Deleted"
End If
End Sub
General Category Command Button
Private Sub GEN_Click()
adogrid.RecordSource = "Select * from Student_Info where Category='GEN'"
adogrid.Refresh
adogrid.Caption = adogrid.RecordSource
End Sub
Search By Roll No or Name :GO command Button

Private Sub gosearch_Click()
adogrid.RecordSource = "Select * from Student_Info where RollNo='" + Text1.Text + "' or Name='" + Text1.Text + "'"
adogrid.Refresh
If adogrid.Recordset.EOF Then
MsgBox "Record Not Found,Enter any other Roll No or Name", vbCritical, "Message"
Else
adogrid.Caption = adogrid.RecordSource
End If
End Sub
OBC Category Command Button
Private Sub obc_Click()
adogrid.RecordSource = "Select * from Student_Info where Category='OBC'"
adogrid.Refresh
adogrid.Caption = adogrid.RecordSource
End Sub
Plus One Class Command Button
Private Sub plusone_Click()
adogrid.RecordSource = "Select * from Student_Info where Class='Plus One'"
adogrid.Refresh
adogrid.Caption = adogrid.RecordSource
End Sub
Plus Two Class Command Button
Private Sub plustwo_Click()
adogrid.RecordSource = "Select * from Student_Info where Class='Plus Two'"
adogrid.Refresh
adogrid.Caption = adogrid.RecordSource
End Sub
SC Category Command Button
Private Sub sc_Click()
adogrid.RecordSource = "Select * from Student_Info where Category='SC'"
adogrid.Refresh
adogrid.Caption = adogrid.RecordSource
End Sub
ST Category Command Button
Private Sub st_Click()
adogrid.RecordSource = "Select * from Student_Info where Category='ST'"
adogrid.Refresh
adogrid.Caption = adogrid.RecordSource
End Sub
View All Records Command Button
Private Sub viewall_Click()
adogrid.RecordSource = "Select * from Student_Info"
adogrid.Refresh
adogrid.Caption = adogrid.RecordSource
End Sub
Please leave  comments and suggestions.
If you like my video,Please Hit like button and Subscribe to my channel for latest updates on tutorials.

 
google-site-verification: google18fa7bfb27754a8a.html google-site-verification: google089e704d9968b9b7.html