How can I remove zeros in my search? ie search for "000103" returns "103". Here is my search code:
<%
' Get search criteria for basic search
pSearch = trim(Request.QueryString("psearch")
If pSearch <> "" Then
pSearch = replace(pSearch,"'","''"
pSearch = replace(pSearch,"[","[[]"
b_search = b_search & "[CustomerNumber] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerName] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerAddress] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerCity] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerState] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerZip] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerGrpCode] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerOwnersCode] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerSalesRep] LIKE '%" & pSearch & "%' OR "
End If
If len(b_search) > 4 Then
b_search = mid(b_search,1,len(b_search)-4)
b_search = "(" & b_search & ""
End If
%>
<%
'Build search criteria
If a_search <> "" Then
dbwhere = dbwhere & a_search 'advance search
ElseIf b_search <> "" Then
dbwhere = dbwhere & b_search 'basic search
End If
'Save search criteria
If dbwhere <> "" Then
Session("tablename" = tablename
Session("dbwhere" = dbwhere
'reset start record counter
startRec = 1
Session("Customer_REC" = startRec
Else
If tablename = Session("tablename" Then
dbwhere = Session("dbwhere"
Else
'reset search criteria
dbwhere = ""
Session("dbwhere" = dbwhere
End If
End If
'Get clear search cmd
If Request.QueryString("cmd".Count > 0 then
cmd=Request.QueryString("cmd"
If ucase(cmd) = "RESET" Then
'reset search criteria
dbwhere = ""
Session("dbwhere" = dbwhere
End If
End If
%>
<%
strsql = "select * from [Customer]"
If dbwhere <> "" Then
strsql = strsql & " WHERE " & trim(dbwhere)
End If
if OrderBy <> "" then
strsql = strsql & " ORDER BY [" & OrderBy & "] " & Session("Customer_OT"
end if
%>
<input type="Text" name="psearch" size=10>
<input type="Submit" name="Submit" value="GO!">
<%
' Get search criteria for basic search
pSearch = trim(Request.QueryString("psearch")
If pSearch <> "" Then
pSearch = replace(pSearch,"'","''"
pSearch = replace(pSearch,"[","[[]"
b_search = b_search & "[CustomerNumber] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerName] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerAddress] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerCity] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerState] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerZip] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerGrpCode] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerOwnersCode] LIKE '%" & pSearch & "%' OR "
b_search = b_search & "[CustomerSalesRep] LIKE '%" & pSearch & "%' OR "
End If
If len(b_search) > 4 Then
b_search = mid(b_search,1,len(b_search)-4)
b_search = "(" & b_search & ""
End If
%>
<%
'Build search criteria
If a_search <> "" Then
dbwhere = dbwhere & a_search 'advance search
ElseIf b_search <> "" Then
dbwhere = dbwhere & b_search 'basic search
End If
'Save search criteria
If dbwhere <> "" Then
Session("tablename" = tablename
Session("dbwhere" = dbwhere
'reset start record counter
startRec = 1
Session("Customer_REC" = startRec
Else
If tablename = Session("tablename" Then
dbwhere = Session("dbwhere"
Else
'reset search criteria
dbwhere = ""
Session("dbwhere" = dbwhere
End If
End If
'Get clear search cmd
If Request.QueryString("cmd".Count > 0 then
cmd=Request.QueryString("cmd"
If ucase(cmd) = "RESET" Then
'reset search criteria
dbwhere = ""
Session("dbwhere" = dbwhere
End If
End If
%>
<%
strsql = "select * from [Customer]"
If dbwhere <> "" Then
strsql = strsql & " WHERE " & trim(dbwhere)
End If
if OrderBy <> "" then
strsql = strsql & " ORDER BY [" & OrderBy & "] " & Session("Customer_OT"
end if
%>
<input type="Text" name="psearch" size=10>
<input type="Submit" name="Submit" value="GO!">