How to Use Wildcards In IDC Files

Last reviewed: April 18, 1997
Article ID: Q147361
The information in this article applies to:
  • Microsoft Internet Information Server 1.0

SUMMARY

When you use the Internet Database Connector (IDC) to query data from an ODBC database, you may need to use wild-cards in your SQL statements in the IDC file. The ODBC wildcard character is the percent (%) sign. After you set up an HTML query form, make sure that the percent (%) sign is entered in the query data.

WORKAROUND

If you do not want to instruct users to add the wildcard character to their queries, you can add the wildcard to the query data in the IDC file. In an IDC file, the single percent (%) sign is used to delimit the variables that are passed to it from the HTML form. Therefore, use two percent signs (%%) to insert the wild-card.

For example, given a form defined like this:

   <FORM METHOD="POST" ACTION="/scripts/getprod.idc">
      <P>Enter Name of product: <INPUT NAME="prdname">
      <P><INPUT TYPE="SUBMIT" VALUE="Run Query">
   </FORM>

In the Internet Database Connector file, GETPROD.IDC, you can append a wild- card to the user's input with the following sytax:

   SQLStatement:
   + SELECT * from products
   + where prod_name like '%prdname%%%'

If the user types in the word "paper" as input to the form, the resulting query (after translation of the variables) is:

   SELECT * from products where prod_name like 'paper%'

This selects any row from the database where the product name starts with the word "paper," followed by other characters.


Additional query words: prodiis wildcard
Keywords : iishowto iisodbc kbnetwork
Version : 1.0
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.