,
[ Pobierz całość w formacie PDF ]
.14 0672324806 CH11 12/12/02 2:43 PM Page 446446 CHAPTER 11 ADO Express Components for C++Builder" OnConnectComplete() Notifies the application that the connection has beencompleted." OnInfoMessage() Notifies the application that the provider is offering an infor-mational message; this should occur right after the connection is made." OnBeginTransComplete() Notifies the application that the transaction hasbegun." OnCommitTransComplete() Notifies the application that the commit hascompleted." OnRollbackTransComplete() Notifies the application that the rollback hascompleted." OnWillExecute() Notifies the application that the command will be executed,but has not yet started to execute.Note that this is fired for any componentsthat use the connection, as opposed to the same event on the individualcomponent, which only fires when that component is asked to execute acommand.Because TADOCommand offers no events, this is the only way to handlea TADOCommand execution-related event." OnExecuteComplete() Notifies the application that the command execution iscomplete." OnDisconnect() Notifies the application that the connection has been closed.TADOCommand EventsTADOCommand does not have any events.TADOCustomDataSet Descendant Events" OnEndOfRecordset() Notifies the application that the end of the recordset (inother words, EOF) has been reached." OnFetchComplete() Notifies the application when an asynchronously executedSQL command has completed the production of a recordset." OnFetchProgress() Periodically notifies the application of the progress of anasynchronously executed SQL command." OnFieldChangeComplete() Notifies the application that a change to the underly-ing database field (not the VCL TField descendant) has completed." OnMoveComplete() Fires when the database cursor movement has completed(similar to the TDataSource OnDataChange() event).14 0672324806 CH11 12/12/02 2:43 PM Page 447Creating Generic Database Applications 447" OnRecordChangeComplete() Notifies the application that the record change hasbeen completed.This is separate from the completion of changes to therecordset." OnRecordsetChangeComplete() Notifies the application that the recordset changeis complete." OnWillChangeField() Notifies the application that ADO is prepared to performa field change, but the change has not yet occurred." OnWillChangeRecord() Notifies the application that ADO is prepared to performa record change, but the change has not yet occurred." OnWillChangeRecordset() Notifies the application that ADO is prepared toperform a recordset change, but the change has not yet occurred." OnWillMove() Notifies the application that ADO is prepared to move thecursor, but the change has not yet occurred.Creating Generic Database ApplicationsMany developers have had to deal with a requirement to create programs that workon a database or table specified at runtime.Most of the techniques for doing thiswith BDE programs are well known and well documented.Not so for the ADOcomponents, but it is fairly simple to do these things after you know where to look.Getting a Connection String from the UserBecause connection strings are so complex and vary greatly between providers, it isfortunate that there is an undocumented function call that can help.This call isPromptDataSource(), which can be found in the ADODB.hpp include file provided withC++Builder, and it has the following signature:WideString PromptDataSource(int theWindowHandle,WideString theOriginalConnectionString);This function presents the same dialog as displayed by the connection string prop-erty editor actually, it is the secondary dialog (from clicking Build) because the firstdialog simply displays the string for manual editing.If you provide an originalconnection string, the dialog sets its controls accordingly so that the user is editingthe connection string rather than creating it.Note that this is not a TADOConnectionmember it is a standalone function.14 0672324806 CH11 12/12/02 2:43 PM Page 448448 CHAPTER 11 ADO Express Components for C++BuilderGetting Table NamesTADOConnection::GetTableNames() works essentially the same asTSession::GetTableNames().It will update a supplied string list (that may, for instance,be the Items property of a TComboBox or TListBox).Naturally, the connection must beopen for this to work [ Pobierz całość w formacie PDF ] |
Archiwum
|