Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

please help with wildcard

Status
Not open for further replies.

CRuser89

Programmer
May 18, 2005
79
US
Hello everyone,

I am new to VBScript. I need some help w/wildcarding. I have the following piece of code:

********************************************************
sEmpTitle = formatForSQL( Request.Form("EmpTitle") )
If Not sManagerName = "" Then
AppendAndClause
m_sWhereClause = m_sWhereClause & "E.EmpTitle"
AppendLikeOrEqualClause sEmpTitle
m_sWhereClause = m_sWhereClause & " '" & sEmpTitle & "' "
End If
*******************************************************

The AppendAndClause Function is just appending the 'AND' and the AppendLikeOrEqualClause is below:

*******************************************************
Private Function AppendLikeOrEqualClause( sString )
If InStr( 1, sString, WILDCARD_CHAR ) > 0 Then Call AppendLikeClause()
Else
Call AppendEqualClause()
End If
End Function
*********************************************************

Currently if someone searches and puts in an * (wildcard), it will append the "LIKE" condition but if someone puts in anything else like 't', 'jo', 'q', it won't append the "LIKE" clause but the "AND" clause instead - therefore I can't search by wildcarding. Can someone please help me rewrite the function above so that it will check based on wildcard?

Thanks for your help...
 
The wildcard character in SQL is %
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top