How to Use Wildcards In IDC Files

ID: Q147361


The information in this article applies to:
  • Microsoft Internet Information Server version 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 : kbnetwork iisodbc iishowto
Version : 1.0
Platform : WINDOWS
Issue type :


Last Reviewed: May 4, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.