0% found this document useful (0 votes)
127 views3 pages

Adodc Connection Coding in vb6

This document contains code for managing a recordset in VB using ADO. It includes procedures for adding, updating, deleting, and navigating records. On form load, it opens a connection to an Access database and recordset. Buttons allow adding new records, updating existing ones, clearing fields, deleting records, and moving forward or backward through the recordset.

Uploaded by

janani
Copyright
© Attribution Non-Commercial (BY-NC)
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)
127 views3 pages

Adodc Connection Coding in vb6

This document contains code for managing a recordset in VB using ADO. It includes procedures for adding, updating, deleting, and navigating records. On form load, it opens a connection to an Access database and recordset. Buttons allow adding new records, updating existing ones, clearing fields, deleting records, and moving forward or backward through the recordset.

Uploaded by

janani
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 3

Dim conn As New ADODB.

Connection

Dim rs As New ADODB.Recordset

Private Sub add_Click()

rs.AddNew

rs!id = Text1.Text

rs!Name = Text2.Text

rs!quantity = Text3.Text

rs!price = Text4.Text

rs.Update

End Sub

Private Sub Command3_Click()

rs!id = Text1.Text

rs!Name = Text2.Text

rs!quantity = Text3.Text

rs!price = Text4.Text

rs.Update

End Sub

Private Sub Command6_Click()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text4.Text = ""

End Sub

Private Sub delete_Click()


rs.delete

MsgBox "want to delete tis record ?", vbYesNo

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text4.Text = ""

MsgBox "ur record has been deleted successfully", vbOK

rs.movenext

End Sub

Private Sub Form_Load()

conn.Provider = "Microsoft.Jet.OLEDB.4.0"

conn.Open "C:\Documents and Settings\Janani\Desktop\item.mdb"

rs.Open "shop", conn, adOpenDynamic, adLockOptimistic, adCmdTable

End Sub

Private Sub display()

Text1.Text = rs!id

Text2.Text = rs!Name

Text3.Text = rs!quantity

Text4.Text = rs!price

End Sub

Private Sub movenext_Click()


rs.movenext

If rs.EOF Then

rs.MoveFirst

display

End If

display

End Sub

Private Sub moveprevious_Click()

rs.moveprevious

If rs.BOF Then

rs.MoveLast

display

End If

display

End Sub

You might also like