There are several basic techniques that can be used to read/write databases. The exact technique used depends on the data source that must be accessed. There are three basic types of data sources that can be accessed with Active Call Center:
Since the specifics of the first two types of data sources vary greatly, we will omit that discussion here. Sample code demonstrating a simple query of a Microsoft Access database from Active Call Center is shown below:
' Variables for database access.
' DAO would be similar. This is ADODim adoConnection, adoRecordset' Initialize the database connection.Set adoConnection = CreateObject("ADODB.Connection")' Open the database, use Microsoft Jet OLEDB data provideradoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ AppPath & "\Examples\Database Example.mdb"' Create a recordset object.Set adoRecordset = CreateObject("ADODB.Recordset")' Open the recordset.adoRecordset.Open "SELECT * FROM LookupTable WHERE " + _ "SomeLookupNumber = " + Answer_Phone, _ adoConnection, 2, 3, -1' Check if a value was retrieved.If adoRecordset.EOF = False Then ' There is a value, tell the user. Speak1 = "The following value was read from the database:" Speak2 = adoRecordset.Fields("SomeText").Value Speak3 = "Goodbye"End If' Close recordset and connection (this will happen automatically anyway).adoRecordset.CloseadoConnection.Close
For more information on programming ADO and DAO through COM, refer to Microsoft's developer and support sites. An example Call Tree named "Database Example" is provided for further reference in the Examples folder.