Tips for Data Access and Data Services


Using Double Quotation Marks in String Fields

When using a string field in the Recordset.Filter property, replace all single quotes (') with double quotes ("). For example, in order for the following code to work, all single quotes in strSubject must be replaced. Note that strings must also be wrapped in single quotes.

   strSubject = "This isn't an example."        ' For testing purposes
   Set rs = Server.CreateObject("ADODB.Recordset")
   rs.Filter = "text='" & Replace(strSubject, "'", "''") & "'"
   rs.Open "Subject", Application("FmLib_ConnectionString"), adOpenForwardOnly, adLockOptimistic, adCmdTable


Database Triggers

Don't use database triggers when a constraint is all you need.

For example, if we define a trigger on the request table to detect if a new record is a duplicate request, we can look up the borrower# and bib# in the request table and if a match is found, the insertion is rolled back. Although this is a good example, it's the wrong place to use a trigger. A better way to enforce the data integrity rule is to create a unique constraint for borrower# and bib# on the request table. If the constraint is violated, the database disallows the insertion. Same effect, different mechanism.

A better use of triggers is found in the fm_tr_queue_dequeue stored procedure (in the Request table). This trigger recalculates the ordinal position of each request in a queue as records are removed. No other mechanism is available to do this, so a trigger is the right choice in this situation.


Version Incompatibilities Between ADO 1.5 and ADO 2.0

While installing a component built with Visual Basic® 6.0 on a server without the Internet Explorer 4.0 Service Pack 1, the component can be instantiated, but an error may appear during methods invoking ADO database operations.

Visual Basic 6.0 uses the latest version of ADO, which is incompatible with previous versions.

To fix the problem, either reinstall Visual Basic or reinstall the latest release of MDAC (Microsoft Data Access Components).


Full-Text Search Error

If the search service is not installed, or if the full-text catalog has not been set up correctly, you may encounter the following error while searching the library:

error '80040e14' 
/FMLib/librarysearch/search.asp, line 31 

Make sure the Full-Text Search service (Microsoft® Search) is installed and running. Full-Text Search can be installed only from the Custom options menu of the SQL Server™ 7.0 installation.


SQL Server Client Configuration for TCP/IP Protocol

If the CML application's SQL Server database is installed on a different server than IIS, you will need to select TCP/IP on your database computer as the default connection protocol in the Network Library tab of the SQL Server Client Configuration Utility. This is because Windows NT® cannot use the default protocol (named pipes) to impersonate user account privileges twice. This restriction directly affects your ability to administer the application. Since Windows NT has already impersonated the admin account, the named pipe call to the SQL Server will fail.

Note  The behavior of the SQL Server Client Configuration Utility has been changed slightly in SQL 7.0. In earlier versions, you could gain full access to the utility from the ODBC Data Source Administrator control panel by pressing the Client Configuration button in the SQL Server DSN Configuration Wizard. Now you must start the utility from the Start menu to get full access. You can only edit individual properties of the connection protocols for the connection you are creating, but you cannot set the default access protocol for SQL Server from the ODBC configuration wizard.