notes on ado from other projects please use speaker notes for additional information!

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

Upload: margery-boone

Post on 13-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

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

Notes on ADO from other projects

Please use speaker notes for additional information!

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

UpdateUpdate

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

Private Sub cmdAdd_Click() ADODonor.Recordset.AddNewEnd Sub

Private Sub cmdDelete_Click() ADODonor.Recordset.Delete ADODonor.Recordset.MoveFirstEnd Sub

Private Sub cmdMoveFirst_Click() ADODonor.Recordset.MoveFirstEnd Sub

Private Sub cmdMoveLast_Click() ADODonor.Recordset.MoveLastEnd Sub

Private Sub cmdMoveNext_Click() ADODonor.Recordset.MoveNextEnd Sub

Private Sub cmdMovePrevious_Click() ADODonor.Recordset.MovePreviousEnd Sub

Private Sub cmdUpdate_Click() ADODonor.Recordset.UpdateEnd Sub

CodeCode

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

Private Sub Form_Load()Dim strConnectStr As String

databasepath = App.PathIf Right(databasepath, 1) <> "\" Then databasepath = databasepath & "\"End Ifdatabasepath = databasepath & "donor.mdb"strConnectStr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source="strConnectStr = strConnectStr & databasepathADODonor.ConnectionString = strConnectStr'ADODonor.CommandType = adCmdText'ADODonor.RecordSource = "SELECT * from Donor2000 ORDER BY DIdno"ADODonor.CommandType = adCmdTableADODonor.RecordSource = "Donor2000"ADODonor.RefreshADODonor.Recordset.Sort = "DIdno"End Sub

CodeCode

Another approach.

Making this form portable.

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

PrDonorinGrid.vbpPrDonorinGrid.vbp

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

PrDonorinGrid.vbpPrDonorinGrid.vbpConnection 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.

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

PrDonorinGrid.vbpPrDonorinGrid.vbp

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

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

PrADOACDstuy.vbpPrADOACDstuy.vbp

The beginning steps to add a new record.

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

PrADOACDstuy.vbpPrADOACDstuy.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.

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

PrSQL4ADOy.vbpPrSQL4ADOy.vbp

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

PrSQL4ADOy.vbpPrSQL4ADOy.vbp

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

PrSQL5ADOy.vbpPrSQL5ADOy.vbp

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

PrSQL5ADOy.vbpPrSQL5ADOy.vbp

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

PrSQL6ADOy.vbpPrSQL6ADOy.vbp

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

PrSQL6ADOy.vbpPrSQL6ADOy.vbp

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

PrSQL6ADOy.vbpPrSQL6ADOy.vbp

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

PrSQL6ADOy.vbpPrSQL6ADOy.vbp

Bookmark or hold the current location.

When no match is found the holdBookmark is used.