This isnt a dynamic sql string, you have defined it literally. This
mySQL1="SELECT sort,custname,city,tel1,tel2,tel3 FROM crminfo where sort=pSort1 and city=pcity and (tel1=ptel1 or tel1=ptel2 or tel1=ptel3 or tel2=ptel1 or tel2=ptel2 or tel2=ptel3 or tel3=ptel1 or tel3=ptel2 or tel3=ptel3") and custname like %pcustname%"
should be
mySQL1="SELECT sort,custname,city,tel1,tel2,tel3 FROM crminfo where sort='" & pSort1 &"' and city='" & pcity &"' and (tel1='" & ptel1 &"' or tel1='" & ptel2 &"' or tel1='" & ptel3 &"' or tel2='" & ptel1 &"' or tel2='" & ptel2 &"' or tel2='" & ptel3 &"' or tel3='" & ptel1 &"' or tel3='" & ptel2 &"' or tel3='" & ptel3 &"') and custname like %" & pcustname &"%"
hth.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Beginning Visual C# 2008
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========