Presentation is loading. Please wait.

Presentation is loading. Please wait.

Notes on ADO from other projects Please use speaker notes for additional information!

Similar presentations


Presentation on theme: "Notes on ADO from other projects Please use speaker notes for additional information!"— Presentation transcript:

1 Notes on ADO from other projects Please use speaker notes for additional information!

2 Update

3 Private Sub cmdAdd_Click() ADODonor.Recordset.AddNew End Sub Private Sub cmdDelete_Click() ADODonor.Recordset.Delete ADODonor.Recordset.MoveFirst End Sub Private Sub cmdMoveFirst_Click() ADODonor.Recordset.MoveFirst End Sub Private Sub cmdMoveLast_Click() ADODonor.Recordset.MoveLast End Sub Private Sub cmdMoveNext_Click() ADODonor.Recordset.MoveNext End Sub Private Sub cmdMovePrevious_Click() ADODonor.Recordset.MovePrevious End Sub Private Sub cmdUpdate_Click() ADODonor.Recordset.Update End Sub Code

4 Private Sub Form_Load() Dim strConnectStr As String databasepath = App.Path If Right(databasepath, 1) <> "\" Then databasepath = databasepath & "\" End If databasepath = databasepath & "donor.mdb" strConnectStr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" strConnectStr = strConnectStr & databasepath ADODonor.ConnectionString = strConnectStr 'ADODonor.CommandType = adCmdText 'ADODonor.RecordSource = "SELECT * from Donor2000 ORDER BY DIdno" ADODonor.CommandType = adCmdTable ADODonor.RecordSource = "Donor2000" ADODonor.Refresh ADODonor.Recordset.Sort = "DIdno" End Sub Code Another approach. Making this form portable.

5 PrDonorinGrid.vbp

6 Connection string is done in Form_Load to make the program portable. The caption code puts a caption over the specified columns. The visible code eliminates two columns. In this program we do not see street address or zip. Note also the width code which sets the width of two columns.

7 PrDonorinGrid.vbp The column information specified in the code on the previous slide is implemented.

8 PrADOACDstuy.vbp The beginning steps to add a new record.

9 PrADOACDstuy.vbp In form load, the connection string and record source are established. The recordset is also sorted by idno (the key field). Here I add a new record with AddNew, populate it with data and then Update the field that I added.

10 PrSQL4ADOy.vbp

11

12 PrSQL5ADOy.vbp

13

14 PrSQL6ADOy.vbp

15

16

17 Bookmark or hold the current location. When no match is found the holdBookmark is used.


Download ppt "Notes on ADO from other projects Please use speaker notes for additional information!"

Similar presentations


Ads by Google